-
Notifications
You must be signed in to change notification settings - Fork 121
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
base: main
Are you sure you want to change the base?
Conversation
Adds a new webook adapter following https://learn.microsoft.com/en-us/azure/azure-functions/functions-node-upgrade-v4 Fixes #737
… Type (#742) * type: fix Azure Function v4 Adapter HttpRequest and Context Type * type: fix remove unnecessary export types
That is what I meant by my comment in #742 (review) :) |
@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;
}>; |
No worries, I can fix it up later today. |
@mildronize please check again |
const azureV4: AzureAdapterV4 = (request) => { | ||
type Res = NonNullable< | ||
Awaited<ReturnType<AzureAdapterV4>["handlerReturn"]> | ||
>; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@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]>
There was a problem hiding this 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.
export type AzureAdapterV4 = ( | ||
request: { headers: Headers; json(): Promise<Update> }, |
There was a problem hiding this comment.
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.
I'll fix this up soon |
Adds a new webook adapter following https://learn.microsoft.com/en-us/azure/azure-functions/functions-node-upgrade-v4
Fixes #737