when I updated `aws-api-gateway-client` from 0.2.17 to version 0.3.3 my Requests failed with status code 403 however it was working well before updating
See original GitHub issueexport function apiRequest(options, cred, result, error) {
var apigClientFactory = require("aws-api-gateway-client").default;
var apigClient = apigClientFactory.newClient({
invokeUrl: BASE_URL, // REQUIRED
region: "us-east-1", // REQUIRED: The region where the API is deployed.
accessKey: cred.accessKeyId, // REQUIRED
secretKey: cred.secretAccessKey, // REQUIRED
sessionToken: cred.sessionToken, // OPTIONAL: If you are using temporary credentials
systemClockOffset: 0, // OPTIONAL: An offset value in milliseconds to apply to signing time
retries: 2, // function. Uses axios-retry plugin. Default is no delay.
retryDelay: "exponential"
});
var pathParams = {};
// Template syntax follows url-template https://www.npmjs.com/package/url-template
var method = "POST";
var additionalParams = {
//If there are query parameters or headers that need to be sent with the request you can add them here
headers: {
"Content-Type": "application/json"
},
queryParams: {}
};
console.log("api client", apigClient);
apigClient
.invokeApi(
pathParams,
`/default/${options.pathTemplate}`,
method,
additionalParams,
options.body
)
.then(response => {
//This is where you would put a success callback
console.log(`${options.pathTemplate} invoke api result`, response);
result(response);
})
.catch(err => {
//This is where you would put an error callback
console.log(`${options.pathTemplate} invoke api error`, err);
error(err);
});
}
Issue Analytics
- State:
- Created 4 years ago
- Comments:9 (2 by maintainers)
Top Results From Across the Web
Fix 403 Forbidden errors when connecting to API Gateway ...
Last updated: 2022-06-17. I'm calling my Amazon API Gateway APIs from my virtual private cloud (VPC), but I get an HTTP 403 Forbidden...
Read more >How do I troubleshoot HTTP 403 errors from API Gateway?
... Knowledge Center article with this video: https://aws.amazon.com/premiumsupport/knowledge-center/api-gateway-troubleshoot- 403 -forbid...
Read more >API.get Sometimes gets 403. · Issue #3567 · aws-amplify ...
Describe the bug Suddenly the response of API.get gets 403. (signature doesn't match) After once I got 403, I keep getting 403 ever....
Read more >AWS Lambda function REST API end point - 403 error
One reason why you'd get 403 on a fresh "no authentication" API Gateway resource is because you haven't yet deployed your changes.
Read more >403 Forbidden Error when calling an AWS API Gateway in ...
I set up a REST API in AWS with a PUT method to upload files to an S3 bucket. The "Authorization" field in...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Hi,
I have the same issue after updating to version 0.3.3. Initially I reverted to 0.2.17, where the identical code worked again.
After reading @AhmedMesawer post, I tested again with v 0.3.3. First without changing any code, same issue. Symptom is a
Content-Length: 0
in the request.After commenting out the
retries
everything works as expected.Looks like this is the source of the bug.
@AhmedMesawer I run into the same problem with 0.3.3. Switching headers to lower case helped me. Try “content-type”.