Bad Request Error

a-bmt02
PRO

5 months ago

I notice that sometimes when i have a larger payload , i get the error below on railway , but sometimes even if the payload is large , it works fine

BadRequestError: request aborted

at IncomingMessage.onAborted (/app/node_modules/raw-body/index.js:245:10)

at IncomingMessage.emit (node:events:517:28)

at IncomingMessage._destroy (node:_http_incoming:224:10)

at _destroy (node:internal/streams/destroy:109:10)

at IncomingMessage.destroy (node:internal/streams/destroy:71:5)

at abortIncoming (node:_http_server:781:9)

at socketOnClose (node:_http_server:775:3)

at Socket.emit (node:events:529:35)

at TCP. (node:net:350:12)

0 Replies

a-bmt02
PRO

5 months ago

N/A


5 months ago

is the request taking longer than 5 minutes? we have a 5 minute request timeout


a-bmt02
PRO

5 months ago

You mean 5 minutes before the server completes the process? Yes sometimesit does. Also i get the error immediately after the payload hits the server


5 months ago

so 5 minutes doesn't come into play at all?


a-bmt02
PRO

5 months ago

Honestly it could because sometimes there are multiple users accessing the server


5 months ago

right but if a single request takes longer than 5 minutes we will close it


a-bmt02
PRO

5 months ago

I'm not sure but i'm guessing the error is because i'm only using one replica. When i increase the replicas , it messes with my SSE.


a-bmt02
PRO

5 months ago

You mean if it runs for more than 5 minutes the connection will be closed? If that's the case that should be one of the issues because some request take more than 5 minutes to complete. What is the solution to this?


5 months ago

Websockets are not subject to the 5 minutes, only HTTP and SSE requests


a-bmt02
PRO

5 months ago

Yes the http request could take longer than 5 minutes. The server uses ffmpeg for video generation so sometimes it does take more than 5 minutes to complete the video generation and send it back to the client.


5 months ago

you would need to move to task queues so that you don't keep the connection open for the entire time


a-bmt02
PRO

5 months ago

Can you please clarify what you mean by move to task queues


5 months ago

you can find lots of resources on that on the interwebs!


a-bmt02
PRO

5 months ago

Will it be ok if i end the request immediately but the server keeps running in the background , and when thats done(may take longer than 5 mins) , i send it back to the client


5 months ago

yes


a-bmt02
PRO

5 months ago

So i have the client send a request to the server , i open an sse to track the progress of the video generation , the video generation goes on for 10 minutes (the sse is also open for 10 minutes) and when the video generation is done , i send another request from the client to retrieve the video


a-bmt02
PRO

5 months ago

this should work with no error right


a-bmt02
PRO

5 months ago

No need to queue anything in this case


5 months ago

that should work


a-bmt02
PRO

5 months ago

Thank you.I'll try that out and let you know


apz-gh
HOBBY

5 months ago

is there some config required for this:

I have a stream of sse events that shuts off exactly at 300s (5 minutes)

i do have the correct response headers


apz-gh
HOBBY

5 months ago

1341346190905704400


a-bmt02
PRO

5 months ago

Hi @Brody , Im trying to set up redis using the railway template but its not working. I set it up from the railway dashboard but when i try to connet from my nodejs server i get connection error

1342282563062071300
1342282563548483600


5 months ago

please see our docs on this topic -


5 months ago

and please use reference variables -


a-bmt02
PRO

5 months ago

Thanks brody. The article helped i was able to fix the issue


5 months ago

awesome!


a-bmt02
PRO

5 months ago

Hey Brody , it seems like my redis server only works on one tasks(not concurrent) even though i set the concurrency to 2 using bullmq in my nodejs server


5 months ago

I'm sorry but that would be an issue with your code


a-bmt02
PRO

5 months ago

Ah ok i'll keep checking then. I'm just making sure there isnt any railway settings that im missing


5 months ago

nope we have no interaction with how your code talks to Redis