Amazon SES error on valid body / subject

This seems related to the unresolved post: Error on sending HTML email with Amazon SES - #12 by RicardoE105

I have an amazon ses node. If I input:
subject: test
body: test

then it sends successfully.

if i type in plain text the following, it errors:

subject: [my company] followup
body: anything that includes commas, parathesis, hyphens or colons. :,(,),

it alternates between two different errors depending on what I put in the subject or body

{
"message": "400 - """,
"name": "Error",
"stack": "Error: Request failed with status code 400 at createError (/usr/local/lib/node_modules/n8n/node_modules/axios/lib/core/createError.js:16:15) at settle (/usr/local/lib/node_modules/n8n/node_modules/axios/lib/core/settle.js:17:12) at IncomingMessage.handleStreamEnd (/usr/local/lib/node_modules/n8n/node_modules/axios/lib/adapters/http.js:269:11) at IncomingMessage.emit (events.js:327:22) at endReadableNT (internal/streams/readable.js:1327:12) at processTicksAndRejections (internal/process/task_queues.js:80:21)"
}
Stack
NodeApiError: Bad request - please check your parameters
    at Object.awsApiRequest (/usr/local/lib/node_modules/n8n/node_modules/n8n-nodes-base/dist/nodes/Aws/SES/GenericFunctions.js:27:15)
    at processTicksAndRejections (internal/process/task_queues.js:93:5)
    at async Object.awsApiRequestSOAP (/usr/local/lib/node_modules/n8n/node_modules/n8n-nodes-base/dist/nodes/Aws/SES/GenericFunctions.js:42:22)
    at async Object.execute (/usr/local/lib/node_modules/n8n/node_modules/n8n-nodes-base/dist/nodes/Aws/SES/AwsSes.node.js:1047:40)
    at async /usr/local/lib/node_modules/n8n/node_modules/n8n-core/dist/src/WorkflowExecute.js:447:47

and then this:

{
"message": "403 - "<ErrorResponse xmlns=\"http://ses.amazonaws.com/doc/2010-12-01/\">\n <Error>\n <Type>Sender</Type>\n <Code>SignatureDoesNotMatch</Code>\n <Message>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.</Message>\n </Error>\n <RequestId>UUID</RequestId>\n</ErrorResponse>\n"",
"name": "Error",
"stack": "Error: Request failed with status code 403 at createError (/usr/local/lib/node_modules/n8n/node_modules/axios/lib/core/createError.js:16:15) at settle (/usr/local/lib/node_modules/n8n/node_modules/axios/lib/core/settle.js:17:12) at IncomingMessage.handleStreamEnd (/usr/local/lib/node_modules/n8n/node_modules/axios/lib/adapters/http.js:269:11) at IncomingMessage.emit (events.js:327:22) at endReadableNT (internal/streams/readable.js:1327:12) at processTicksAndRejections (internal/process/task_queues.js:80:21)"
}
Stack
NodeApiError: Forbidden - perhaps check your credentials?
    at Object.awsApiRequest (/usr/local/lib/node_modules/n8n/node_modules/n8n-nodes-base/dist/nodes/Aws/SES/GenericFunctions.js:27:15)
    at processTicksAndRejections (internal/process/task_queues.js:93:5)
    at async Object.awsApiRequestSOAP (/usr/local/lib/node_modules/n8n/node_modules/n8n-nodes-base/dist/nodes/Aws/SES/GenericFunctions.js:42:22)
    at async Object.execute (/usr/local/lib/node_modules/n8n/node_modules/n8n-nodes-base/dist/nodes/Aws/SES/AwsSes.node.js:1047:40)
    at async /usr/local/lib/node_modules/n8n/node_modules/n8n-core/dist/src/WorkflowExecute.js:447:47

Following up. the things causing failure are: Square brackets in the subject causes the 400
And a COMMA in the body causes the 403 error. If that one comma in the last sentence is removed the email sends successfully. :dizzy_face:

Hello

We received a request to send you a Profile Questionnaire to register or update your profile with xxxx.

Please click here to continue:
If you didn’t request this, please ignore this email and well remove your email address.

Many thanks for reporting this! Sounds like it could be an encoding problem. I shall take a closer look into this once I have a bit more time if no one else gets to this first.

If I urlencode the subject or body, it will send anything. But of course it shows up as urlencoded in the received email.

It is hard to believe I’m the only one using the SES integration, or that I’m the first to find these issues. Which makes me wonder if it is something on my end? (Though I send a lot of email through SES with other systems that are using exactly the same text/encoding that doesn’t fail)

this seem to be related to both of these:

Hey I opened that issue on GitHub.

For those looking for an alternative, I did post about just using the ‘Email’ node in n8n with AWS SES. See my GitHub comment here: AWS SES Node: Malformed Query String · Issue #1442 · n8n-io/n8n · GitHub

Cheers thank you. Looks like I’ll do the same for now.

1 Like

And after creating and trying to test the Send Email node with credentials I know work, I get this error:

Error: 140257041132872:error:1408F10B:SSL routines:ssl3_get_record:wrong version number:../deps/openssl/openssl/ssl/record/ssl3_record.c:332:

Solution for the above error, is that SES SMTP requires port 465, not 587

2 Likes

Hello guys, just wanted to leave my comment here as I’m having the same issue as OP. It confused me and I’m ashamed to admit that I wasted more time than I would’ve liked, from re-creating IAM user to rebuilding docker containers, etc. I ended up nailing it down to the semicolon, and after a couple of google searches I stumpled upon this thread. I was trying to send a link into the SES email body and the “:” part of the url made it crash with the same error as OP.

I can confirm the Send Email node works perfectly as a workaround, although for those who use SES templates, this might not work for them.

1 Like

looks like I reported this earlier but it couldn’t be reproduced by Jan. I’m happy to see though I’m not the only one with this issue. AWS ERROR: Forbidden - perhaps check your credentials? - #11 by davidbamboo

I’ve completely reinstalled the stock ubuntu 20.04 server, docker and n8n. still the issue persists.

I think the module is not escaping the message correctly. I am not able to send a message containing “:”

Hi @Hugh, thx for reminding me of this one. I was able to reproduce the problem and have added this to our internal bug tracker for a closer look & fix.

Hello everyone.

A fix has been merged and should be released in the next version. Kudos to @Michael_Kret for the implementation.

In case you’re interested the PR can be found here: n8n-4331-aws-ses-sending-emails-including-special-characters-fails by michael-radency · Pull Request #3896 · n8n-io/n8n · GitHub

1 Like

Got released with [email protected]