4

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.

6
  • 1
    It's an async call, so most likely a result is never returned and the function times out while waiting. Enable some logging and check to see if that request is being made and responded to. Commented Jan 23, 2019 at 14:35
  • if i log something before getIdentity it is log, but something after the function is not log. I have tried to set a timeout of 25 seconds but same thing happen. Commented Jan 23, 2019 at 14:45
  • You need logs on the server side of things, not the client side Commented Jan 23, 2019 at 14:47
  • I don't understand, I put my log in my lambda function just before the line getIdentityVerificationAttributes, and one log after getIdentityVerificationAttributes. First one is executed but not the second log. Commented Jan 23, 2019 at 14:53
  • I forgot to mention that my lambda is running inside a vpc, might that be the problem ? Commented Jan 23, 2019 at 15:09

1 Answer 1

4

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.

Sign up to request clarification or add additional context in comments.

4 Comments

I saw something called private link, is this available for SES? or can I only achieve this with NAT Gateway? I am using my lambda in a VPC because i need to access my database with vpc peering.
Private Link is not available for SES. Maybe you can move the SES-related ops to a function outside the VPC and pass required information to it via API Gateway if you don't want to set up NAT
PrivateLink is available for SES as of Apr. 2020, but I haven't been able to get it to work. announcement
Same i have been trying for hours to make SES work from lambda which is in VPC. But getting timeout.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.