Skip to content

Commit

Permalink
Read val from event
Browse files Browse the repository at this point in the history
  • Loading branch information
standielpls committed Oct 29, 2024
1 parent 8c40940 commit d114e07
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions packages/core/src/tools/create-lambda-handler.js
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,10 @@ const createLambdaHandler = (appRawOrPath) => {
// Wait for all async events to complete before callback returns.
// This is not strictly necessary since this is the default now when
// using the callback; just putting it here to be explicit.
context.callbackWaitsForEmptyEventLoop = true;
// In some cases, the code hangs and never exits because the event loop is not
// empty.
context.callbackWaitsForEmptyEventLoop =
event.callbackExitsAfterApp || true;

// replace native Promise with bluebird (works better with domains)
if (!event.calledFromCli) {
Expand Down Expand Up @@ -265,12 +268,6 @@ const createLambdaHandler = (appRawOrPath) => {

const input = createInput(compiledApp, event, logger, logBuffer, rpc);

// When the app is done, callback() will be called and the Lambda function will end.
// In some cases, perhaps due to fetching large data blobs, the Lambda function
// will hang waiting for the event loop to drain. Setting this to false will
// prevent that and return when the callback is called.
context.callbackWaitsForEmptyEventLoop = false;

return app(input);
})
.then((output) => {
Expand Down

0 comments on commit d114e07

Please sign in to comment.