1

My frontend client written in Angular 8, occasionally throws a 504 Gateway error for my api requests. My API is hosted in AppEngine Standard env, with a min of 5 instances always active. Backend API written in nodejs + express.

Since its a 504 gateway timeout, none of the errors are captured by the backend logging.

How can I debug this to find out what's causing my errors?

z k
  • 11
  • 1

1 Answers1

1

This is usually due to a long running process from the app engine that doesn't finish before the configured timeout. Best way that I can think to debug this is to add more logs in your processes and see if something is taking longer than usual when you get the 504.

Ideally you want to offload longer running processes to another product like Cloud Tasks that has a longer timeout period so that App Engine can send a response quickly and have the processing done in the background.

Sam Calamos
  • 1
  • 2
  • 5
  • 1
    Thanks! I shouldn't have long running processes, its a basic API server that's supposed to read from mongodb and process and send back responses. Most of my response latencies are around 300-400ms. I guess though if the express code gets stuck somewhere and does not return a response, then appengine will classify it as a long running process. I'll look deeper into it. – z k Jun 09 '20 at 23:40