Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add support for Azure Functions v4 #738

Open
wants to merge 7 commits into
base: main
Choose a base branch
from

Conversation

KnorpelSenf
Copy link
Member

… Type (#742)

* type: fix Azure Function v4 Adapter HttpRequest and Context Type

* type: fix remove unnecessary export types
@KnorpelSenf
Copy link
Member Author

That is what I meant by my comment in #742 (review) :)

@mildronize
Copy link

@KnorpelSenf I see, actually i don't know which prop is used, or I should be something like this

export type AzureAdapterV4 = (request: {}, context: {}) => ReqResHandler<{
    status: number;
    body?: string;
} | {
    jsonBody: string;
}>;

@KnorpelSenf
Copy link
Member Author

No worries, I can fix it up later today.

@KnorpelSenf
Copy link
Member Author

@mildronize please check again

Comment on lines +287 to +290
const azureV4: AzureAdapterV4 = (request) => {
type Res = NonNullable<
Awaited<ReturnType<AzureAdapterV4>["handlerReturn"]>
>;
Copy link

@mildronize mildronize Jan 17, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CleanShot 2568-01-17 at 19 14 36

@KnorpelSenf After I've check out the new code from the latest commit from #738, (Commit id: 8f9e16e5114421dc0dacab51f899f7d4538f0184)

you checkout the code from here: https://github.com/mildronize/grammy-azure-functions-test/tree/44221d1b5b0f0589347403d4636b9d19fa504874/func-v4

the request type error:

Argument of type 'HttpRequest' is not assignable to parameter of type '{ headers: Headers; json(): Promise<Update>; }'.
  The types returned by 'headers[Symbol.iterator]()' are incompatible between these types.
    Property '[Symbol.iterator]' is missing in type 'SpecIterator<[string, string], any, undefined>' but required in type 'HeadersIterator<[string, string]>

Copy link

@mildronize mildronize left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've found that the Azure v4, request type is mismatched, however, azure v3 is ok now.

Comment on lines +89 to +90
export type AzureAdapterV4 = (
request: { headers: Headers; json(): Promise<Update> },

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, I comment the wrong place, here is what I mentioned in the comment below.

@KnorpelSenf
Copy link
Member Author

I'll fix this up soon

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support Azure Functions v4 Model for webhookCallback
2 participants