Service Times Out on Outbound API Calls (504 Error)

gigaprojects
HOBBY

3 days ago

Hello,

I have a service that is timing out with a 504 error, and I have diagnosed it as an outbound networking issue.

My setup: An Nginx proxy service forwards requests to a private Python/Gunicorn service (billing-service). The service receives the request, but its external API calls to Stripe and Google's Firebase Auth API are timing out after 2 minutes. This causes the Nginx proxy to return a 504 error.

I have exhaustively confirmed the following:

  • The service starts cleanly with no errors.

  • All API keys and credentials are correct and are being successfully loaded from environment variables (confirmed with print statements in the logs).

  • The service passes its health check.

This indicates that the container is being blocked from making outbound API calls. Could you please check the outbound network policies or firewall rules for my billing-service container?

Solved$10 Bounty

2 Replies

Railway
BOT

3 days ago

Hey there! We've found the following might help you get unblocked faster:

If you find the answer from one of these, please let us know by solving the thread!


3 days ago

Hello,

The issue is likely stale DNS. Every time the upstream service is deployed, its IP changes, and NGINX will continue using the old IP, which results in NGINX sending you a 504.

To fix this, you must configure NGINX to resolve every 1s.

The internal DNS server is - fd12::10

You have to use this to configure NGINX to re-resolve DNS every second at minimum, since that is the lowest frequency you can set.

Thought, the ideal solution here is to use Caddy because Caddy will do dynamic DNS lookups based on the TTL of the domain.

I will go ahead and open this up to the community so that they can help you with the implementation.

Best,

Brody


Status changed to Awaiting User Response Railway 3 days ago


3 days ago

This thread has been marked as public for community involvement, as it does not contain any sensitive or personal information. Any further activity in this thread will be visible to everyone.

Status changed to Open brody 3 days ago


Status changed to Solved chandrika 2 days ago