Get "connection reset by peer" errors for file upload patch requests

Hi! I try to setup a NestJS service on railway to upload files to a storage with TUS. I'm stuck now though because I get on the client a "connection reset by peer" errors when the PATCH requests is send for the first chunks and the request is then pending. I already tried to switch our DNS to see if that might cut of the connection but that has not changed any thing. Is there a configuration that I could miss that limits the request size or the TTL? Thank you!
Solution:
thats a redirect status code, are you sure you are using https when calling the upload?
Jump to solution
11 Replies
Percy
Percy4d ago
Project ID: cf5c91bb-c069-4b97-ad70-f0a04931d017
KirioXX
KirioXX4d ago
cf5c91bb-c069-4b97-ad70-f0a04931d017
Brody
Brody4d ago
how large is the file? do you have the edge proxy enabled?
KirioXX
KirioXX4d ago
Hi Brody, thanks for the response. TUS is configured at the moment to send chunks of 512KB. I don't have the edge proxy enabled for my test service.
Brody
Brody4d ago
if this is indeed an issue with the proxy, you will need to be on the edge proxy as any issues with the legacy proxy will not be getting fixed on account of it being deprecated sooner or later, please let me know if you continue to see this issue after switching to the edge proxy. one thing to note is that switching to the edge proxy is not instantaneous, a surefire way to know your requests are fulfilled by the edge proxy would be to check the server response header, on the edge proxy it will be railway-edge on the legacy proxy it will be railway
KirioXX
KirioXX4d ago
Thanks for letting me know Brody. I enabled the edge-proxy and I get now a different response. The request is now not pending when it sends the PATCH request instead I get a 301 error and I'm sure that response code is not coming from my application because I would see that in the logs.
Brody
Brody4d ago
would it be possible for you to give me a way to see this error for myself?
KirioXX
KirioXX4d ago
Yes this is the error message I get in my app: "unexpected status code (301) while uploading chunk" I'll try to get the request for you too
Solution
Brody
Brody4d ago
thats a redirect status code, are you sure you are using https when calling the upload?
KirioXX
KirioXX4d ago
You are spot on. This is a bug in my server it generates a url for the tus upload and that is not setting it to https instead it changes it to http. Sorry for that confusion and thank you very much Brody!!!!
Brody
Brody4d ago
no problem, happy to help!