feat(lambda): support async handler functionality #2909
Closed
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.
PR allows using the Lambda handler created by
ApolloServer.createHandler
in either async (preferred) or callback mode. The current callback implementation has issues with the Node 10 runtime (see #2705) and this PR does not attempt to fix that. Instead it sidesteps it by allowing usage without a callback, which works in Node 10.To summarize what this means (Node 6 is aging out this month, so I won't include it since this is would be in a future release):
Due to the issues the callback version has with the Node 10 Lambda runtime, it should be deprecated and the docs should be changed to use the async method.
DISCLAIMER: This PR is not heavily tested. I banged it out real quick after running into #2705 and did quick sanity checks to ensure that basic usage worked in both Node 10.x and Node 8.10. It wouldn't shock me if the automated tests fail for this PR, and it probably needs some test coverage.