artur-bx
artur-bx5d ago

Internal actions and fetch in Convex

Help with internal actions and fetch in Convex Hi everyone, I'm having an issue with internal actions in Convex, and I'd appreciate some guidance. I have two internal actions: CheckTransaction: Checks the status of a transaction in the database. FetchExternalData: Makes a fetch request to an external server and, based on the response, updates the status in the database. The problem: Sometimes, the external server is down, and even though I set a timeout for the fetch request, the function gets stuck. This is critical because I'm running the CheckTransaction action every 2 seconds using ctx.runAfter, but the execution freezes and doesn't throw any error (not even a 504). It just doesn't respond. What I've tried: Setting a timeout on the fetch to force a controlled failure. Confirming that ctx.runAfter keeps executing. Should I consider any other configuration for the fetch action to handle this situation better? Is there any recommended pattern for making fetch requests to unstable servers? Thanks in advance for your help!
No description
No description
1 Reply
ballingt
ballingt5d ago
If you curl or fetch() that server that's down, what do you get? In order to test a potential fix we need a way to reproduce the behavior of that server. Do you think it's accepting the connection but not responding? Testing now, I think timeouts like this might not be implement in the Convex v8 runtime, so that's something we should support

Did you find this page helpful?