I'm using serverless-offline plugin for testing aws lambda functions locally. But when I'm trying to send a response back to the user with res.send() the method throws me below error.
Debug: internal, implementation, error
TypeError: Uncaught error: Cannot read property 'done' of undefined
at createLambdaContext (/home/lenovo/workspace/moneyspring-backoffice-api-services/node_modules/serverless-offline/src/index.js:671:44)
at process.nextTick (/home/lenovo/workspace/moneyspring-backoffice-api-services/node_modules/serverless-http/lib/dispatch.js:7:9)
at _combinedTickCallback (internal/process/next_tick.js:131:7)
at process._tickDomainCallback (internal/process/next_tick.js:218:9)
Early response will be highly appreciated.
Looks like a duplicate of https://github.com/dherault/serverless-offline/issues/659 that was closed.
The cause is cleanup happening before asynchronous handler finishes executing
https://github.com/dherault/serverless-offline/blob/91a9a7b75cb9f2ef3cab9baa2aeaf5d3b740f668/src/index.js#L974-L982
Have you tried this workaround https://github.com/dherault/serverless-offline/issues/661#issuecomment-493202885?
Reverting to [email protected] fixed this issue for me in the short term, same error found in 4.10.1,2,3
Same, although I reverted to 4.9 instead
I am encountering this also.
What about v4.10.4?
Seems to be fixed in v4.10.5. or maybe with serverless 1.43.0... I updated both today and error is gone.
Upgrading from 4.10.2 to 4.10.5 fixed the issue for me.
Most helpful comment
Seems to be fixed in v4.10.5. or maybe with serverless 1.43.0... I updated both today and error is gone.