0

I have a flask API container deployed on Lightsail. When I make a request to one of the API endpoints, I get a 504 gateway error as the status on the client-side. However, when I check the server logs on Lightsail, I see that the server returned data successfully with status code 200.

I'd like to ask for suggestions regarding what might have gone wrong on the server as everything runs fine when the container is run locally.

Mosky1970
  • 11
  • 1
  • We'll need more info on the connections between the client and the container. It may help to draw yourself a diagram of each step and check each connection. It could be a load balancer issue, a cloudfront issue, or it could be something like you've run out of burstable cpu credits. We need more info :D – shearn89 Jan 14 '22 at 14:08
  • @shearn89 Thanks for the info. As this is my first time deploying to AWS, I don't know a lot about how the load balancers or CloudFront but here's some information that may be helpful: My container service capacity is small (1GB RAM, 0.5vCPUs with a scale of 1). The faulty endpoint basically saves a bunch of images to a pdf file on s3 and returns a file object as a response to the client. This usually takes up to 100 seconds locally but takes only about 61 seconds on Lightsail (with the 504 error returned). Other less intensive endpoints work perfectly fine. – Mosky1970 Jan 15 '22 at 23:08
  • Sounds like something has a 60 second timeout and isn't always working. I would consider looking into porting your code to a Lambda function, probably using SAM (https://aws.amazon.com/serverless/sam/). In the meantime, check CloudWatch for logs from your containers? – shearn89 Jan 17 '22 at 08:31

0 Answers0