Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

aws lambda SES function timeout

I am using nodejs version 8.1 and severless framework

in my serverless.yml I have:

provider:
  name: aws
  runtime: nodejs8.10
  region: eu-west-1
  iamRoleStatements:
  - Effect: "Allow"
    Action:
      - "ses:GetIdentityVerificationAttributes"
    Resource: "*"

and my lambda looks like this:

const AWS = require('aws-sdk');
var ses = new AWS.SES({
  region: 'eu-west-1'
});
module.exports.handler = async (event, context, callback) => {
 context.callbackWaitsForEmptyEventLoop = false;
 let identityVerif = await ses.getIdentityVerificationAttributes({Identities: ['email']}).promise();
}

I don't understand why the getIdentity function is never executed. The function exit with a timeout.

like image 671
superphung Avatar asked Oct 28 '25 08:10

superphung


1 Answers

You're waiting for the response of an async call, and it's likely that you aren't getting one. Check the SES API logs in CloudTrail to make sure that the request is actually being made. It sounds like your lamdba function can't access SES, which would happen if you are running it in a VPC. You would need to add a NAT Gateway to the VPC. Consider moving your lambda outside of your VPC. Here is a guide to help determine the tradeoffs.

like image 81
bwest Avatar answered Oct 31 '25 00:10

bwest