Getting 413 (Request Entity Too Large) on server action #60270
Replies: 19 comments 13 replies
-
did you find the solution? |
Beta Was this translation helpful? Give feedback.
-
any solution ? |
Beta Was this translation helpful? Give feedback.
-
For anyone reading this, I was with this problem for 1 month and turns out it was nginx settings and not NextJS. Just added |
Beta Was this translation helpful? Give feedback.
-
Hi there, it seems that vercel sets a body limit (4.5MB) for the serverless functions check this If anyone has other solution please share it here |
Beta Was this translation helpful? Give feedback.
-
Hi, I'm getting the same error "Request entity too large" Does anyone know how to fix this issue? |
Beta Was this translation helpful? Give feedback.
-
https://vercel.com/guides/how-to-bypass-vercel-body-size-limit-serverless-functions |
Beta Was this translation helpful? Give feedback.
-
Hello, I'm running into the same error message: 413 Payload Too Large. My site is dedicated to background removal and uses FastAPI with Python, Next.js, and TypeScript. For the background removal process, I rely on rembg. Everything works fine locally, but after deploying to Vercel, it doesn't run properly when the API is called. When I check the network activity, I see the Payload Too Large error. |
Beta Was this translation helpful? Give feedback.
-
+1 |
Beta Was this translation helpful? Give feedback.
-
any solution, by setting this
doesnt seem to work in my app router. |
Beta Was this translation helpful? Give feedback.
-
+1 |
Beta Was this translation helpful? Give feedback.
-
+1 |
Beta Was this translation helpful? Give feedback.
-
I found a solution: convert your server action into an API route and use it that way. This approach will resolve the issue. |
Beta Was this translation helpful? Give feedback.
-
If anybody is using Supabase Storage try using createClient in client version like this:
Then you can upload your files directly in the client side code instead of using api routes / server actions. In summary, just move your logic to client side code instead of passing formData to api route and it should work. You can also try other options: https://vercel.com/docs/errors/FUNCTION_PAYLOAD_TOO_LARGE |
Beta Was this translation helpful? Give feedback.
-
Hi All, I might have a simple solution for this. Let's say the Next.js application is deployed on either Azure Static Web Apps or Amplify; both are serverless architectures. I’ve also tried all these options, but none of them worked for me. You can check out this blog to reach a conclusion. |
Beta Was this translation helpful? Give feedback.
-
Hi there, if your problem is just the upload, try this: https://vercel.com/docs/storage/vercel-blob/client-upload It worked for me. But now, I'm figuring out a different problem, it's during file fetch.
Any suggestions? Maybe I don't know how to make the onUploadCompleted step work properly. If your problem is just with the upload, this will help you figure out this issue. |
Beta Was this translation helpful? Give feedback.
-
any solution? |
Beta Was this translation helpful? Give feedback.
-
Consider it if it was a file with less than 1MB only then it was working properly without that we can not able to upload images |
Beta Was this translation helpful? Give feedback.
-
I think is not understable to have a server action that is getting a 413 but throw no error in the code, how should a dev manage it? Always have to return data to check for undefined to understand if server action failed? In our case the upload server action got 413 but throwed no errors (it was not reaching nextjs server as nginx was whining first) with next 14.2.26 |
Beta Was this translation helpful? Give feedback.
-
Another day another dumb next.js issue |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Summary
Hello devs, I really need some help here. It would be glad if you guys help me.
Sending image to server using server action works fine with smaller images. The 413 error occurs when I request to send an image that is bigger than 5mb and it seems like the image size is bigger than the body size limit.
Since it is just a server action, I don't think below config is working(as far as I know below code is only for the page
route.ts
).I tried to increase bodySizeLimit to "20mb" in my
next.config.js
but it does not seem to increase the body size limit as expected. Any ideas to reduce this error?Additional information
Example
No response
Beta Was this translation helpful? Give feedback.
All reactions