Request Signing Error
Closed this issue · 1 comments
dt-atkinson commented
Since upgrading to version 0.2.17 we are getting signing errors on our requests. I believe it may be related to this change:
https://github.com/kndt84/aws-api-gateway-client/pull/70/files#diff-7de6072e915823a140a4447fa80cd3d5R215
headers[HOST] = parser.hostname;
was changed to headers[HOST] = parser.host;
This is only in the case that host was not supplied.
Difference in documentation for url.parse
indicates the only difference being the port returned. This could presumably cause the signing issue.
Example error:
error: Error response was:
{
"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.\n\nThe Canonical String for this request should have been\n'POST\n/v3/v1/send-message\n\naccept:application/json\ncontent-type:image/jpeg\nhost:api.url.com\nx-amz-date:20190722T075057Z\n\naccept;content-type;host;x-amz-date\na3e98aa8b2745ffccdf3ff64cc5b13bebe5eff5da9cb2bfac2d28a49d242515f'\n\nThe String-to-Sign should have been\n'AWS4-HMAC-SHA256\n20190722T075057Z\n20190722/eu-west-1/execute-api/aws4_request\nd076d394b89d64ca99dd9b600792ce06815927bd97bcbc0018a362f901f14986'\n"
}