We are using machines on fly for some agent workflow and background tasks along with upstash. The initial request or wakeup call to server returns 502 most of the time causing the request to be retried later. This is what I get from dashboard:
Fly Doctor
Symptom: App is not listening to the expected port
Something in your code or configuration is preventing your app from listening on 0.0.0.0 at the port specified by your fly.toml internal_port 3000. Your users will see error 502 accessing your app. This is an issue with your application code.Your app could be missing environment variables. Some frameworks require specific environment variables to be set otherwise they stop your app.
The app could be listening to the wrong port, you can either change your fly.toml internal_port or modify your application code to listen on the correct port.
Make sure your app is listening to 0.0.0.0 and not localhost or 127.0.0.1.
Your app could not be listening at all, check your logs to make sure it’s running correctly.
After making the necessary changes, you can deploy the updates from the deployments page or fly deploy on your computer.
How should I prevent the 502 status codes?