TanishqxSharma
TanishqxSharma3mo ago

Timeout issue Convex API via Middleware.

Hi, I am trying to call convex api from a node.js middleware. Everything seems to work fine when I am running it locally but once deployed to Railway. There is a timeout issue with the api. The server tries to connect with convex but it fails. Any Idea?
No description
20 Replies
erquhart
erquhart3mo ago
That ENETUNREACH ending with - Local (:::0) looks sus, any hardcoded addresses anywhere in your code?
TanishqxSharma
TanishqxSharmaOP3mo ago
Nope, Nothing as such, for this one I passed a hardcoded convex url (for testing) but everything is from env other than that there is fastify websocket connection where this call gets invoked
erquhart
erquhart3mo ago
Is this self hosted?
TanishqxSharma
TanishqxSharmaOP3mo ago
Nope
erquhart
erquhart3mo ago
Can you share the code with the api call
TanishqxSharma
TanishqxSharmaOP3mo ago
Yeahh sure
TanishqxSharma
TanishqxSharmaOP3mo ago
this is where I am actually calling I have created a function for query that I am sharing with this
No description
TanishqxSharma
TanishqxSharmaOP3mo ago
I hard coded the url currently to test but it's not hardcoded in general
No description
erquhart
erquhart3mo ago
When you say running it locally works, are you running against a local or cloud deployment?
TanishqxSharma
TanishqxSharmaOP3mo ago
Against a local, how you usually test your api, "npm run dev" then with the local host url you hit in my case using postman with this host http://localhost:3001/try-convex with some args, this works fine and returns the data but I have it deployed somewhere and it's a different domain that is accessing convex but I am assuming the APIs are public and that should not cause an issue.
No description
erquhart
erquhart3mo ago
Can you try running convex dev on your machine against a cloud dev instance If it happens there we can cut railway/production out of the issue and just debug in dev
TanishqxSharma
TanishqxSharmaOP3mo ago
Ummm, this is not a convex project, it's a separate node application altogether with some logic for websockets.
erquhart
erquhart3mo ago
That's fine, I imagine you can run that node application locally. Run it locally against a Convex cloud dev deployment. If the issue reproduces, you can debug it locally.
TanishqxSharma
TanishqxSharmaOP3mo ago
Okay, I am clueless now! I should just convex dev in the node-apps and this should work fine? Oh Gotcha, on a side server i locally run convex then hit this url. I've tried that, the request doesn't reach to my local at all
erquhart
erquhart3mo ago
So you know how you can run the Convex dev server either locally or in a cloud deployment?
TanishqxSharma
TanishqxSharmaOP3mo ago
npx convex dev --local --once this right? I haven't tried it
erquhart
erquhart3mo ago
So when you're running convex dev locally, are you using that local flag or just npx convex dev
TanishqxSharma
TanishqxSharmaOP3mo ago
nope not yet, I haven't ran it locally
erquhart
erquhart3mo ago
Everything seems to work fine when I am running it locally
What did this mean? Are you running your node app locally against your production convex deployment?
TanishqxSharma
TanishqxSharmaOP3mo ago
Yess this I understood a little let me try this.

Did you find this page helpful?