Post Change Password Action

I am encountering a generic error message “Error! API Error. Please contact support if the problem persists” while running the code I have included below. Can anyone provide an explanation for the cause of this error?

Code:

const AWS = require(‘aws-sdk’);
const ses = new AWS.SES();

exports.onExecutePostChangePassword = async (event, api) => {
try {
const user = event.user;
const context = { request: event.request };
const { AWSCredentials } = context.clientMetadata;

      AWS.config.update({
        accessKeyId: AWSCredentials.accessKeyId,
        secretAccessKey: AWSCredentials.secretAccessKey,
        region: AWSCredentials.region
      });

      await sendPasswordChangedEmail(user , context);

  } catch (error) 
  {
      console.log(error)
  }

};

async function sendPasswordChangedEmail(user, context) {
const { email } = user;
const { request } = context;
// Send email using Amazon SES
const params = {
Destination: {
ToAddresses: [email]
},
Message: {
Body: {
Text: {
Data: “This email is to confirm that your password has been changed.”
}
},
Subject: {
Data: “Password Changed”
}
},
Source: ‘no-reply@gmail.com’,
};
try {
await ses.sendEmail(params).promise();
} catch (error) {
console.log(error);
}
}

Hey team! :waving_hand:

Since this topic touches Auth0 Actions, quick heads-up that we’re hosting an Ask Me Anything dedicated to Actions with Gaston Danilo Asis Sanchez, Senior Technical Product Manager. We’ll cover practical usage, new capabilities like Transaction Metadata and Actions Types, plus a peek at what’s next. :sparkles:

  • Submit questions now through Aug 26 :writing_hand:
  • Get detailed written answers live on Aug 27, 9–11 AM PT :speech_balloon:

Earn community points + a badge :trophy:. If you’re exploring how Actions can streamline your auth flows, this is a great time to get direct guidance from the team.
Join the AMA & drop your questions here: August 27 Auth0 Community Ask Me Anything: Actions

Dawid