Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AuthorizationHeaderMalformed on a custom AWS HTTP request #10459

Open
srdosramos opened this issue Aug 16, 2024 · 2 comments
Open

AuthorizationHeaderMalformed on a custom AWS HTTP request #10459

srdosramos opened this issue Aug 16, 2024 · 2 comments
Labels
in linear Issue or PR has been created in Linear for internal review

Comments

@srdosramos
Copy link

Bug Description

Issue: When creating a custom HTTP request to the AWS S3 endpoint, an error is encountered:

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

Details: Upon inspecting the error details, it was found that the authorization header is incorrect. Here is an example of the erroneous authorization header displayed in the error details:

"Authorization": "AWS4-HMAC-SHA256 Credential=AXXXXXXXXXXXXXXXXXLX/20240816/s3/s3/aws4_request, SignedHeaders=accept;content-type;host;x-amz-content-sha256;x-amz-copy-source;x-amz-date;x-amz-metadata-directive, Signature=f755fcae13c82b74d67XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXd3"

In the authorization header, the service s3 is duplicated (/s3/s3/aws4_request) instead of specifying the region. It should be /us-east-1/s3/aws4_request.

Correct Example: The correct format for the authorization header should be as follows:

"Authorization": "AWS4-HMAC-SHA256 Credential=AXXXXXXXXXXXXXXXXXLX/20240816/us-east-1/s3/aws4_request, SignedHeaders=accept;content-type;host;x-amz-content-sha256;x-amz-copy-source;x-amz-date;x-amz-metadata-directive, Signature=f755fcae13c82b74d67XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXd3"

Fix the authorization header to include the appropriate region to resolve this issue.

To Reproduce

On a workflow:

  1. Add a HTTP Request node
  2. Choose the method PUT
  3. On the URL: point it to a bucket file https://[bucket].s3.amazonaws.com/[filepath]
  4. Choose Authentication to Predefined Credential type
  5. Choose the Credential type to AWS
  6. Choose a AWS credential with the right permissions to call the S3 API
  7. Add the following headers: "x-amz-copy-source":"/[bucket]/[filepath]", "x-amz-metadata-directive":"REPLACE", "content-type": "text/html"

Expected behavior

The file on the url should change the content type to text/html

Operating System

Ubuntu 22.04

n8n Version

v1.54.4

Node.js Version

v20.15.0

Database

PostgreSQL

Execution mode

main (default)

@Joffcom
Copy link
Member

Joffcom commented Aug 16, 2024

Hey @srdosramos,

We have created an internal ticket to look into this which we will be tracking as "GHC-168"

@Joffcom Joffcom added the in linear Issue or PR has been created in Linear for internal review label Aug 16, 2024
@Joffcom
Copy link
Member

Joffcom commented Aug 20, 2024

Hey @srdosramos,

Quick update, I have taken a look and have moved this to our Nodes / Integrations team to resolve in a future release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in linear Issue or PR has been created in Linear for internal review
Projects
None yet
Development

No branches or pull requests

2 participants