XAmzContentSHA256Mismatch when passing more than one item to the AWS S3 node

Greetings to the n8n community ! :grinning:

I’m looking to create a workflow to retrieve several binary files every day and upload them to an s3 bucket.

It works perfectly when I pass a single item to the S3 bucket but when I pass several items (with a different content).
I get the following error on node s3 :

XAmzContentSHA256MismatchThe provided ‘x-amz-content-sha256’ header does not match what was computed.0938a9d36ef5e3e0defd71b25fd57e8798bc8f0949637d2af7569cfdc90dc7c0b7a6fe22095b487d7d8ed174ac3412fe992a84677ea6233f60030ae797887ab8AE6AC72411B3A75DmrolbCNOitoiIpCLk6VsAfOJuFqqpHB5/HA/+C48Gj33+a6PfDZ85jALehQLNSc+pc8ugjntM9s=

Important note : The first item is uploaded correctly, this error occurs when the second item is attempted.
This leads me to believe that the hash is calculated only once, and is not recalculated when there are several items.

As I can’t really share my worfklow because of the data it contains, I recreated a very simple test workflow to recreate the error.

A function that returns 5 distinct items with a node that allows you to upload the content to a file.
The first file is correctly uploaded, from the second one I get the error from the top:

{
“name”: “debug”,
“nodes”: [
{
“parameters”: {},
“name”: “Start”,
“type”: “n8n-nodes-base.start”,
“typeVersion”: 1,
“position”: [
250,
300
]
},
{
“parameters”: {
“functionCode”: “const newItems = ;\nfor (let pas = 0; pas < 5; pas++) {\n const json = ‘{"val":"fichier n’+pas.toString()+‘"}’;\n const obj = JSON.parse(json);\n newItems.push({json: obj});\n}\nreturn newItems;”
},
“name”: “Function”,
“type”: “n8n-nodes-base.function”,
“typeVersion”: 1,
“position”: [
500,
300
]
},
{
“parameters”: {
“operation”: “upload”,
“bucketName”: “backup-optimi”,
“fileName”: “= {{$node["Function"].json["val"]}}”,
“binaryData”: false,
“fileContent”: “={{$node["Function"].json["val"]}}”,
“additionalFields”: {}
},
“name”: “AWS S3”,
“type”: “n8n-nodes-base.awsS3”,
“typeVersion”: 1,
“position”: [
950,
520
],
“credentials”: {
“aws”: “N8N backup bucket”
}
}
],
“connections”: {
“Start”: {
“main”: [
[
{
“node”: “Function”,
“type”: “main”,
“index”: 0
}
]
]
},
“Function”: {
“main”: [
[
{
“node”: “AWS S3”,
“type”: “main”,
“index”: 0
}
]
]
}
},
“active”: false,
“settings”: {},
“id”: “62”
}

It looks related to this topic Trying to upload attachments from Gmail to S3 but no solution seems to have been found.

I looked at the source code of the node but found nothing relevant. Does anyone have an idea? :pray:

Thanks a lot !

Jules