Working example of custom API call for AWS S3

Although the AWS S3 node supports Custom API call through the HTTP Request node, I couldn’t find a working example on how to do so.
For instance, I’d like to do a HEAD operation on a file in a bucket, I’ve added an HTTP Request node, selected the predefined credential for AWS, set the URL as the file https://<BUCKET>.s3.amazonaws.com/<PATH_TO_FILE>, expecting that the signature parameters would be magically appended to the URL, but I just get a simple “400 rejected - Bad request - please check your parameters”.
If I switch method to GET, I get a different error:

`AuthorizationHeaderMalformed`The authorization header is malformed; the region 's3' is wrong; expecting 'us-east-1'

My credential has the region properly filled in.
I’m probably missing something obvious here.

It looks like your topic is missing some important information. Could you provide the following if applicable.

  • n8n version:
  • Database (default: SQLite):
  • n8n EXECUTIONS_PROCESS setting (default: own, main):
  • Running n8n via (Docker, npm, n8n cloud, desktop app):
  • Operating system:

Check if that style is supported in the docs, as I see most methods do not use full URLs.

You can also open the dev console (f12 > console tab) and see what headers/body have been sent via HTTP Request node

I tried to use /<BUCKET>/<PATH_TO_FILE> in the URL, but then I get Invalid URL from the HTTP node.
I understand that the URL in the format https://<BUCKET>.s3.amazonaws.com/<PATH_TO_FILE> is correct, however there’s still something missing.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.

Good news!
So I’ve finally managed to do a HEAD request to an object on S3:

Essentially, what I was getting wrong is the URL, which worked using https://s3.amazonaws.com/<bucket_name>/<object_key>, which was a bit counter intuitive because path-style requests on AWS is deprecated: Virtual hosting of buckets - Amazon Simple Storage Service

I tested the above example with GET and HEAD, both worked properly.

I’d love to understand how to use Custom API Call on the AWS S3 node. Would you please point me to a working example?

1 Like