rjobidon
rjobidon

Reputation: 3155

AWS API Gateway Javascript SDK Returns 404 Not Found

When I call my AWS API Gateway from a JavaScript client I get a 404 not found error because the SDK invokes the wrong endpoint:

Instead of

It was fine yesterday. Someone can explain the cause?

UPDATE!

In axios.standalone.js a Microsoft.XMLHTTP ActiveX object is created to send the request. The data parameter has a url member set to "https:abc123.execute-api.us-east-1.amazonaws.com/dev/status". Note there is no slash slash at the beginning. The base URL of the JavaScript client is inserted into the request URL. Please help!

Upvotes: 0

Views: 1287

Answers (2)

Jurgen
Jurgen

Reputation: 1273

There was an issue with the JS SDK generator that has been fixed recently. Please update your JS SDK with a newly generated version.

Best, Jurgen

Upvotes: 1

rjobidon
rjobidon

Reputation: 3155

Modify axios.standalone.js

module.exports = function xhrAdapter(resolve, reject, config) {

      // Temporary fix for missing // in config.url 
      if ((config.url.substr(0, 6) == "https:") && (config.url.substr(0, 8) != "https://")) {     
        config.url = "https://" + config.url.substr(6, config.url.length - 6);
      }

...

Upvotes: 0

Related Questions