Metadata service returned non-200 response with status code of 400 for url
Hi guys,
We have a python app that retrieves creds from IMDS via kube2iam and sometimes we encounter this issue:
Metadata service returned non-200 response with status code of 400 for url: http://169.254.169.254/latest/meta-data/iam/security-credentials/{"AccessKeyId":"ID","Code":"Success","Expiration":"2019-01-29T18:06:11Z","LastUpdated":"2019-01-29T17:36:11Z","SecretAccessKey":"secret","Token":"token","Type":"AWS-HMAC"}, content body: b'400 Bad Request'
I substituted the values with dummy ones.
Then the amount of retries is exhausted and we fail with Error when retrieving credentials from iam-role: Credential refresh failed, response did not contain: access_key, secret_key, token, expiry_time
The botocore version is 1.12.86. I wonder what could be causing that 400
so weirdly it looks like the actual response body is concatenated to the response.url (http://169.254.169.254/latest/meta-data/iam/security-credentials/) . we started to see this issue since updating to 1.12.86
Hi, what version of botocore did you upgrade from? We added more debug information in the logs in 1.12.X ( I think somewhere around 1.12.35) which should not have affected functionality.
If I can compare what version you're upgrading from it should help track down what changes made to the instance metadata service could be affecting you.
Hi @jamesls , thank you for the update! We upgraded from 1.10.4
this seems to be reproduce only with credentials refresh in Celery. Celery uses prefork process pool by default, that could be the cause of the issue.
@TattiQ - Are you still seeing this error with latest version of botocore ?
This issue has been automatically closed because there has been no response to our request for more information from the original author. With only the information that is currently in the issue, we don't have enough information to take action. Please reach out if you have or find the answers we need so that we can investigate further.