Open igorskiter opened 2 years ago
const result = await new Promise(async (resolve, reject) => {
const resProm = await handler(event, context);
resolve(resProm);
});
This is risky, the Promise constructor does not, as far as I know, respect rejected promises and will therefore never settle. It's posisble you have an unhandled rejection being swallowed; you should at least do:
try { res = await .. resolve(res) } catch (e) { reject(e) }
but of course, you can see that this entire promise wrapper is not useful as you can just move the await up!
when trying to send email by sendgrid the lambda does not show log and ends up giving timeout. I've tried putting it inside a promise, but it didn't help. The initial handler has already been placed asyncronously. The same error also happens when I try to upload on S3. This problem only happens when it is deployed on aws, on serverless-offline it works correctly.
handler.js
serveless.yml
sendMail.js