Skip to content

Commit

Permalink
disable callbackWaitsForEmptyEventLoop (#2638)
Browse files Browse the repository at this point in the history
* disable callbackWaitsForEmptyEventLoop 

Disable callbackWaitsForEmptyEventLoop for HTTP OPTIONS request since ApolloServer already disable callbackWaitsForEmptyEventLoop for POST request. (https://github.com/apollographql/apollo-server/blob/1ec2890397ca306350b0e1f33eec7b5f3f951d8d/packages/apollo-server-lambda/src/lambdaApollo.ts#L33)

Otherwise is lambda event loop is not empty, subsequence HTTP OPTIONS request will be hang and even timeout without throwing proper error.

* fix prettier issue

fix prettier issue
  • Loading branch information
bluedusk authored and abernix committed May 13, 2019
1 parent 4e8b504 commit 7fb5a29
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions packages/apollo-server-lambda/src/ApolloServer.ts
Expand Up @@ -119,6 +119,7 @@ export class ApolloServer extends ApolloServerBase {
}

if (event.httpMethod === 'OPTIONS') {
context.callbackWaitsForEmptyEventLoop = false;
return callback(null, {
body: '',
statusCode: 204,
Expand Down

0 comments on commit 7fb5a29

Please sign in to comment.