question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Invalid Header value in request for credentials

See original GitHub issue

It seems like the Generated header based on credentials includes \n characters. I’m pretty sure this is a bug.

botocore.exceptions.HTTPClientError: An HTTP Client raised and unhandled exception: Invalid header value b'AWS4-HMAC-SHA256 Credential=-n ACCESS_KEY\n/00000000/eu-west-1/athena/aws4_request, SignedHeaders=content-type;host;x-amz-date;x-amz-target, Signature=XXXXXXXXXX'

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:14 (5 by maintainers)

github_iconTop GitHub Comments

8reactions
sagarkar10commented, Jun 24, 2021

Faced the same problem, where ever you are reading aws keys from environment k8 use .strip("\n") eg:

AWS_ACCESS_KEY_ID = os.environ.get("AWS_ACCESS_KEY_ID").strip("\n")
AWS_SECRET_ACCESS_KEY = os.environ.get("AWS_SECRET_ACCESS_KEY").strip("\n")
2reactions
swetashrecommented, Apr 6, 2020

In your case a new line is getting appended at the end of env vars. Are you using any tool to manage the credentials ?

Have you tried passing credentials directly during client creation ?

Read more comments on GitHub >

github_iconTop Results From Across the Web

aws s3 ls: An HTTP Client raised an unhandled exception
aws s3 ls: An HTTP Client raised an unhandled exception: Invalid header value · 4. Looks like somehow you included a newline in...
Read more >
Invalid Header value in request for credentials - Bountysource
It seems like the Generated header based on credentials includes \n characters. I'm pretty sure this is a bug.
Read more >
System.CalloutException: Attempt to use invalid header in ...
Seems like you are missing the HTTP header name and that you might not have the exact formatting required for the header value....
Read more >
Reason: expected 'true' in CORS header 'Access-Control ...
To fix this problem on the client side, revise the code to not request the use of credentials. If the request is being...
Read more >
HTTP/1.1: Header Field Definitions
The Accept request-header field can be used to specify certain media types which ... The Authorization field value consists of credentials containing the ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found