Server returns 504 after exactly 5 minutes.

Hello, I am fetching an API endpoint hosted on railway and made with spring boot, this endpoint will itself do some stuff aswell as call other public endpoint that takes 2-10 mins to be available, therefore the returning object to my frontend takes that time to happen. After exactly 5 minutes, backend returns a 504 to the frontend, which doesnt happen when I run the backend locally, any clue?
19 Replies
Percy
Percy2y ago
Project ID: bc72ed00-77ac-4952-811c-d4f8c525ad7b
Percy
Percy2y ago
⚠️ experimental feature
Grand Gambit
Grand GambitOP2y ago
bc72ed00-77ac-4952-811c-d4f8c525ad7b
angelo
angelo2y ago
@Grand Gambit - your application is timing out. Your API needs to deliver it's response quicker than 3 minutes or else we kill the connection.
Grand Gambit
Grand GambitOP2y ago
Is there any way to modify that? Also, it ALWAYS times out after 5 mins not 3
Grand Gambit
Grand GambitOP2y ago
angelo
angelo2y ago
What are you returning in your API? Yea, so something must be happening with your code. How big is the expected object?
Grand Gambit
Grand GambitOP2y ago
not big at all frontend calls endpoint then backend does some stuff and fetches for a transaction in a blockchain to be confirmed (2-10 mins)
angelo
angelo2y ago
thats your issue
Grand Gambit
Grand GambitOP2y ago
and once the transaction is confirmed, it builds and returns an object
angelo
angelo2y ago
So when you have a major async operation, my suggestion is to keep a running cache of chain transaction state reference that Anyways, it does seem like its an issue with your code. Not with Railway. I wish it was so we can just fix it 🙂
Grand Gambit
Grand GambitOP2y ago
I think that it has something to do with railway, because when I run the server locally, it does not return the 504 after exactly five minutes this fetch is done several times, it fetches it and if the returned code is a 404(blockchain tx is not confirmed) it does the call again every 10 seconds
angelo
angelo2y ago
If you need a long running connection while you are awaiting you need to use something like a websocket. Not REST
Grand Gambit
Grand GambitOP2y ago
until it is confirmed and the blockchain api call returns a 200 Oh hmm
angelo
angelo2y ago
All platforms will kill the API call after 5 minutes. Not only us.
Grand Gambit
Grand GambitOP2y ago
I will read more about that I guess, also im a junior dev so please excuse my low knowledge I see
angelo
angelo2y ago
Its okay! It's not super obvious hehe
Grand Gambit
Grand GambitOP2y ago
Will research about that websocket thing, appreciate it!
angelo
angelo2y ago
Np!
Want results from more Discord servers?
Add your server