Closed tommedema closed 6 years ago
Hi @tommedema . This looks like the AWS Lambda runtime isn't awaiting the returned function (which internally is a promise).
This does not seem to be an issue with webpack or the plugin in general, but more likely with TS or the resolver, as everything looks good in the configuration.
According to https://aws.amazon.com/blogs/compute/node-js-8-10-runtime-now-available-in-aws-lambda/ someting like
exports.handler = async (event) => {
return await lambda.getAccountSettings().promise() ;
};
should work. I'm not sure if the __awaiter()
function, generated by TS behaves the same. Is there any way to configure the TS resolver to emit Node 8 (async/await) compatible code that includes the async keyword? Alternatively you could try to add the 3rd lambda parameter (the callback) and experimentally await locally in the function and call the callback.
Can you try that and report back, what happened? This is a quite interesting thing.
@HyperBrain you are correct that it is not related to webpack, sorry about that.
Turns out that one of the promises was rejected but I didn't register a handler for this. I had to encapsulate all promises with try { } catch { }
.
This is a bug report
Description
For bug reports:
My handler function is defined as follows:
Together with the Typescript resolver, this compiles to:
Seems OK. But when running this on AWS lambda, the logs give:
The lambda should not end the request after logging the context. It should also log
generated project files...
webpack.config.js
serverless.yml
(see also https://github.com/serverless-heaven/serverless-webpack/issues/435)
tsconfig.json:
.../../tsconfig.json:
../../tsconfig.base.json:
I've also tried it with tsconfig.json:
But the effect is the same. Note that I am using yarn workspaces (see this repo for an example)
see above for the cloudwatch log
Note that when I run it locally the behavior is the same:
Additional Data
Serverless-Webpack Version you're using: 5.2.0
Webpack version you're using: 4.16.5
Serverless Framework Version you're using: Serverless Version: 1.30.0
Operating System: OS: darwin Node Version: 8.11.3