I try to send an email with the @aws-sdk/client-ses
SDK in Node but I get:
SignatureDoesNotMatch: The request signature we calculated does not match the signature you provided. Check your AWS Secret Access Key and signing method. Consult the service documentation for details.
Here is my code:
const aws = require("@aws-sdk/client-ses");
async function main() {
const ses = new aws.SES({
region: "eu-west-3",
credentials: {
accessKeyId: "REDACTED",
secretAccessKey: "REDACTED"
}
});
await ses.sendEmail({
Destination: {
ToAddresses: ["REDACTED@REDACTED.com"]
},
Message: {
Subject: {
Charset: "UTF-8",
Data: "Test email"
},
Body: {
Text: {
Charset: "UTF-8",
Data: "This is the message body in text format."
}
}
},
Source: "REDACTED@REDACTED.com"
});
}
main().catch(console.error);
Is there something wrong with this code?
Thank you