apollo-server-lambda: createHandler's handler doesn't take a callback #5188
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Lambda has two ways of defining a handler: as an async Promise-returning
function, and as a callback-invoking function.
https://docs.aws.amazon.com/lambda/latest/dg/nodejs-handler.html
Until v2.21.2 our handler was only a callback-invoking function.
Starting to that version, it could be called in either way. This meant
that the TypeScript types for our handler were somewhat vague (see
#5072).
All current Node Lambda runtimes support calling async functions; the
only reason that we didn't just change directly from callback-invoking
to async in v2.21.2 was to support the use case of user code that wraps
our handler in their own function. But now we're doing AS3 so we can
make backwards-incompatible changes, so if you're doing that, you should
just make your handler async too and
await
the result of our handler.Fixes #5018.