kndt84 / aws-api-gateway-client

A client module of AWS API gateway both for Node.js and browsers

Home Page:https://www.npmjs.com/package/aws-api-gateway-client

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Sigv4 Client does not sign requests correctly when there are special characters

Sara-lily opened this issue · comments

We've been using this client for some time now and have just run into an issue with special characters. Our API Gateway requests are of the form:

https://api-url/stage/method/*/*
https://api-url/stage/method?query-params

We've recently needed to add IAM for authorizing these requests and when doing so, we recieve the following message as a response from API Gateway:

"message":"The request signature we calculated does not match the signature you provided. Check your AWS Secret Access Key and signing method. Consult the service documentation for details."

When we exchange the '*'s with other alpha-numeric characters, everything works correctly. When we move the query params into the additional parameters section and remove the '?' everything works fine as well.

Is there some way to fix the signing so that it can handle these special characters? Is there something I'm missing in getting this to work?

@Sara-lily
I just ran into this same issue when invoking the api like this:
client.invokeApi(null, '/roles?type=${type}', 'GET', {}, {})

Was able to fix it by invoking the API like this:
client.invokeApi(null, '/roles', 'GET', {queryParams: { type }}, {})