Score:0

Gateway Timeout Error AWS Lightsail

pk flag

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.

cn flag
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
Mosky1970 avatar
pk flag
@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.
cn flag
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?
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.