LRK9
LRK9

Reputation: 351

AWS API Gateway error, Network error communicating with endpoint, 504 Gateway Timeout

HTTP/1.1 504 Gateway Timeout

I am getting the same error message as described here:

https://forums.aws.amazon.com/thread.jspa?messageID=729094

However, in that case, they were trying to use a custom port number, and that was the cause of the problem. We are not trying to use a custom port number.

The error is:

{"message": "Network error communicating with endpoint"}

Yesterday I could run this query and it worked fine:

curl "https://api.heddy.com/lkapi/[email protected]&pass=xxx" -X GET --header 'Accept: application/json' --header 'x-api-key: xxx'

I would get back a JWT token and use it to make further queries.

Yesterday I created a new "resource", added it to our API, and then deployed that to our testing stage, which is "lkapi", which you can see in the URL above.

And since I've done that deploy, I can not get through the AWS API Gateway. I have no idea what I have done wrong.

Any thoughts about what I should check?

If I do the verbose version of "curl" I see the error is:

504 Gateway Timeout

This error typically happens if the upstream app is not running. But I know it is running. So what is left? Perhaps misconfigured port?

Upvotes: 4

Views: 22065

Answers (1)

MikeD at AWS
MikeD at AWS

Reputation: 3745

First, try a curl request to your backend integration endpoint using the same parameters that you expect API Gateway to pass. Confirm that the request completes and takes less than 29 seconds, which is the API Gateway timeout.

Next, try calling your API via the test facility in the API Gateway console and inspect the output to get more information. Confirm that API Gateway is calling the correct endpoint and is passing the header and body values that you expect. Also, observe any error messages from calling the integration endpoint.

If that doesn't help, then enable CloudWatch logs on your deployed API, make a few test requests, and inspect the resulting logs.

If you're still unable to figure it out, you can post the output from the previously mentioned steps along with a swagger export of your API. If any of these contain sensitive information, you can PM them to me instead.

Upvotes: 3

Related Questions