a year ago
Hello I get the following error when I depoly my app to railway:
Attempt 5/6 failed: 413 Request Entity Too Large: request body size exceeds allowed maximum
Is there a way to increase this or do I have to adapt my code?
47 Replies
a year ago
I wonder if it's a configuration within your code and or whatever web framework you're using <:Thinking:1360710341239242762>
a year ago
N/A
a year ago
what do you use to parse requests?
a year ago
no no, on your server
a year ago
when you make a request to your server, your server receives the request and parses it to make it understandable, typically you have some sort of parser like body-parser or a json parser to make sense of the request, and these parsers often have preset limits that you can increase - my theory is that, since you said you didn't set anything, you likely haven't changed the default limit on these meaning that your body size could exceed the predefined limit; the solution here would be to increase the limit
yeah okay I have bodyParser I set its limits to 50 mb
but what I am saying is I get this error when I try to send a request to some other server within my server. I attach 1k strings to the request for that other server and I think it blocks me from sending because of 1k strings

a year ago
what other server? is it your server or a server someone else owns?
its a problem that occurs when I try to make a request from my server to other API
a year ago
what other API? is it your API or an API someone else owns?
Attempt 1/6 failed: 413 Request Entity Too Large: request body size exceeds allowed maximum
Attempt 1/6 failed. Retrying in 200ms
Attempt 2/6 failed: 413 Request Entity Too Large: request body size exceeds allowed maximum
Attempt 2/6 failed. Retrying in 400ms
Attempt 3/6 failed: 413 Request Entity Too Large: request body size exceeds allowed maximum
Attempt 3/6 failed. Retrying in 800ms
Attempt 4/6 failed: 413 Request Entity Too Large: request body size exceeds allowed maximum
Attempt 4/6 failed. Retrying in 1600ms
Attempt 5/6 failed: 502 Bad Gateway:
<title>502 Bad Gateway</title>
<center><h1>502 Bad Gateway</h1></center>
<hr><center>nginx/1.26.2</center>
```
a year ago
If it's someone elses server then they'd need to increase the request limit or you'd need to send less data
unfortunately there's nothing Railway can do about this cause its not within Railway's control what that other API server deems as "too large"
its something that railway blocks me from sending a request that has body size which is bigger than X
a year ago
I assure you it's not something Railway is blocking, it's something the other API server you mention is blocking
a year ago
I'm not sure, maybe you send different data when testing it locally
a year ago
I can check with a Railway team member if you want me to, but I'm very confident Railway doesn't interfere with your requests
would you like me to check with a team member?
a year ago
Alright, then I'll get back to you once I get a response
a year ago
no problem 🙂
a year ago
Alright, team member got back to me and confirmed what I was saying,
He explained that a 413 status code is on layer 7 (of the OSI model), this is the layer that holds all application-level protocols (HTTP, FTP, SSH, SMTP). When your container on Railway makes a request, the request leaving the container is only operating on layer 3 (holding lower-level protocols like IP, and ICMP), naturally on this layer there is no such thing as status codes because status codes (like 413, the error you're seeing) is a concept that only exists on HTTP (which is on layer 7).
Since Railway only handles traffic up until layer 3, there is no way for Railway to respond with a 413 status code because that doesn't happen until you reach layer 7 and by the time your request reaches layer 7 your request would be far out of Railway's reach.
In conclusion, it not only means Railway doesn't interfere with your requests (like I was saying), but it also means Railway couldn't interfere with your request (in the same way you're seeing) even if they wanted to. Ultimately meaning that it is definitely the server you're trying to reach responding with 413, which means you should talk to the developers and or support behind that server (or send less data).
a year ago
It's hard to say, but you should really talk to them if you want to get to the bottom of it because Railway is definitely not interfering with the request. For all we know they could be adjusting the upload limit depending on whether the IP is a residential or datacentre IP address, you'll never know unless you ask
a year ago
Happy to help, best of luck
a year ago
!s
Status changed to Solved dev • 12 months ago