Unable to resolve " not a valid key=value pair (missing equal-sign) in Authorization header" when POSTing to api gateway

I have run across this error when the resolved URL was incorrect. (Or without a proxy but with an incorrect URL.)


For me the reason why it didn't work is because I didn't redeploy when making changes to the integration.

So if you use terraform to create resources, you need to include the triggers part. See: https://www.terraform.io/docs/providers/aws/r/api_gateway_deployment.html#redeployment-triggers

If you're using UI, check: enter image description here


I resolved it. I changed my method to come from the root resource (instead of the unnecessary {proxy+}, and also noticed that my python method was incorrect. I had response = requests.post(url, headers=headers, data=my_json), but data only accepts a string. I have to use either requests.post(url, headers=headers, json=my_json) or requests.post(url, headers=headers,data=json.dumps(my_json))