Verified SES entity (out of sandbox), unable to send production e-mails on deployed website (amplify). Works fully in local dev env. AWS-SDK NodeJS

0

Hello,

I've searched on re:Post but could not find a similar case. I am using AWS-SDK together with NodeJS to send automated mails upon form submit on my website. The e-mail address and domain are verified and out of sandbox. The mailing works when I execute in development mode locally, but not online on production. I have ensured that the env variables are included on Amplify. The code prior to sending the SendMail:

  let AWS = require("aws-sdk");

  AWS.config.update({
    accessKeyId: process.env.KEY_ID,
    secretAccessKey: process.env.KEY_SECRET,
    region: process.env.REGION_ID,
  });

I have applied the ses:Sendmail allow policy in IAM to the user linked to above key/secret. Am I missing something? The shared credentials file is not needed for deployed production if I have the above .config.update right? The policy:

{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Sid": "VisualEditor0",
            "Effect": "Allow",
            "Action": [
                "ses:SendRawEmail",
                "ses:SendEmail"
            ],
            "Resource": "*"
        }
    ]
}

Thank you so much.

1개 답변
0
수락된 답변

I solved it.. in a different way. Responding to this in case anybody has a similar issue. I was not able to get it working using NodeJS directly. I made a lambda function that gets triggered with an API gateway. The button on the website sends a call to the API route which in turn triggers the lambda function with the same code as above. This way it worked and actually separated the mailing functionality nicely from the website.

답변함 2년 전
profile picture
전문가
검토됨 한 달 전

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인

관련 콘텐츠