aws / aws-sdk-js

AWS SDK for JavaScript in the browser and Node.js
https://aws.amazon.com/developer/language/javascript/
Apache License 2.0
7.59k stars 1.55k forks source link

Service: AmazonSimpleEmailService; Status Code: 403 #4610

Closed SreedharLilly closed 5 months ago

SreedharLilly commented 6 months ago

Describe the bug

"Message": "Error sending email: 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. (Service: AmazonSimpleEmailService; Status Code: 403; Error Code: SignatureDoesNotMatch; Request ID: 3488a0f7-3c13-4125-9939-0a99032255be; Proxy: null)"

Expected Behavior

It need to send an email through the AmazonSimpleEmailService

Current Behavior

"Message": "Error sending email: 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. (Service: AmazonSimpleEmailService; Status Code: 403; Error Code: SignatureDoesNotMatch; Request ID: 3488a0f7-3c13-4125-9939-0a99032255be; Proxy: null)"

Reproduction Steps

"Message": "Error sending email: 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. (Service: AmazonSimpleEmailService; Status Code: 403; Error Code: SignatureDoesNotMatch; Request ID: 3488a0f7-3c13-4125-9939-0a99032255be; Proxy: null)"

Possible Solution

No response

Additional Information/Context

No response

SDK version used

1.12.674

Environment details (OS name and version, etc.)

Windows

aBurmeseDev commented 6 months ago

Hi @SreedharLilly - thanks for reaching out.

The error you're seeing is due to the signature mismatch where the signature value in your request to the AWS didn't match the signature that service calculated. How are you signing API requests? Can you provide a minimal reproducible code that would give me more insight on understanding the issue to offer guidance?

Also here's troubleshooting guide for error like this, for your reference: https://docs.aws.amazon.com/IAM/latest/UserGuide/signature-v4-troubleshooting.html

github-actions[bot] commented 6 months ago

This issue has not received a response in 1 week. If you still think there is a problem, please leave a comment to avoid the issue from automatically closing.

ikechiU commented 5 months ago
var credential = BasicAWSCredentials(accessKeyId, secretKey)
AmazonSimpleEmailService client = AmazonSimpleEmailServiceClientBuilder.standard()
                    .withCredentials(new AWSStaticCredentialsProvider(credential))
                    .withClientConfiguration(clientConfiguration)
                    .withRegion(Regions.US_EAST_2)
                    .build();

SendEmailRequest emailRequest = new SendEmailRequest()
                    .withDestination(new Destination().withToAddresses(request.getRecipients()).withCcAddresses(request.getCcList()))
                    .withMessage(new com.amazonaws.services.simpleemail.model.Message()
                            .withBody(new Body().withHtml(new Content().withCharset("UTF-8").withData(request.getNotificationContent()))
                                    .withText(new Content().withCharset("UTF-8").withData(request.getRequesterEmail())))
                            .withSubject(new Content().withCharset("UTF-8").withData(request.getNotificationSubject())))
                    .withSource(defaultSender);

            client.sendEmail(emailRequest);                    

com.amazonaws.services.simpleemail.model.AmazonSimpleEmailServiceException: 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. (Service: AmazonSimpleEmailService; Status Code: 403; Error Code: SignatureDoesNotMatch; Request ID: b1030b99-59fa-43d4-b12f-b54def0b75a9; Proxy: null)

ikechiU commented 5 months ago

@aBurmeseDev