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

The request signature we calculated does not match the signature you provided. Check your AWS Secret Access Key and signing method #100

Closed
bala-drg opened this issue Oct 10, 2019 · 3 comments

Comments

@bala-drg
Copy link

bala-drg commented Oct 10, 2019

i'm getting AWS signature mismatch when i send request to API Gateway using axios

let data = JSON.stringify({
    "action": "message",
    "data": 'testing'
  })


let request = {
  host: '<API GATEWAY ID>.execute-api.<AWS REGION>.amazonaws.com',
  url: 'https://<API GATEWAY ID>.execute-api.<AWS REGION>.amazonaws.com/dev/@connections/<CONNECTION ID>',
  path: 'dev/@connections/<CONNECTION ID>',
  service: 'execute-api',
  region: '<AWS REGION>',
  data: data,
  body: data,
  headers: {
    'Content-Type': 'application/json'
  }
}

let signedRequest = aws4.sign(request,
                {
                  secretAccessKey: '<AWS SECRET KEY>',
                  accessKeyId: '<AWS ACCESS KEY>'
                })

let response = axios(signedRequest)
@MythologicalEngineer
Copy link

@bala-drg Did you find any resolution to this? I'm having the same issue and it seems to have happened quite suddenly.

@MythologicalEngineer
Copy link

MythologicalEngineer commented Nov 27, 2019

I found a fix that worked for me. You have to add body to the request and make it a string of the data object.

example:
request.body = JSON.stringify(request.data);

Put that before the aws4.sign method and it works. The problem is due to how Axios uses data rather than body.

@mhart
Copy link
Owner

mhart commented May 11, 2020

Closing as an issue with axios, not this library

@mhart mhart closed this as completed May 11, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants