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

X-Amzn-Trace-Id header should be omitted while signing #2

Closed
SamVerschueren opened this issue Jul 9, 2020 · 0 comments
Closed

X-Amzn-Trace-Id header should be omitted while signing #2

SamVerschueren opened this issue Jul 9, 2020 · 0 comments
Assignees
Labels
bug Something isn't working

Comments

@SamVerschueren
Copy link
Owner

The X-Amzn-Trace-Id header can be used to for X-ray tracing. If for instance you enable X-ray tracing on API Gateway, the gateway will generate this header for you if it is not provided.

Why should you provide your own you may ask? You could for instance create a private API Gateway that can be called from within your own AWS Lambda functions. If the AWS Lambda function calls the gateway, the gateway will generate a new trace id and we will end up with 2 different traces. Trace 1 being the original lambda invocation, and trace two everything after the API Gateway. If we want this to form one trace from start to end, you can set the X-Amzn-Trace-Id header yourself when calling the API GW (the trace id is stored in the environment variable process.env._X_AMZN_TRACE_ID).

When setting this header BEFORE signing, you will end up with the message Invalid signature. So this means that we will have to remove this header before signing, and add it back after signing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant