Closed thatanjan closed 3 years ago
@thatanjan the config snippet should be added in the API function file, not in next.config.js
Who can explain me how can i add the config? I loaded the config file in the API function file, but doesn't work. What more i need to do?
Who can explain me how can i add the config? I loaded the config file in the API function file, but doesn't work. What more i need to do?
Paste the following code before the handler function.
export const config = { api: { bodyParser: { sizeLimit: '25mb' // Set desired value here } } }
thank you very much it's solve the problem thank's a lot
This issue has been automatically locked due to no recent activity. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you.
What version of Next.js are you using?
11.0.1
What version of Node.js are you using?
v16.5.0
What browser are you using?
Brave
What operating system are you using?
Arch Linux
How are you deploying your application?
next
Describe the Bug
I am trying to build a react image uploader application with nextjs api routes.
The
/api/upload
api file:I try to send a request from my client side code with axios:
It works fine if the file size is less than 1mb. But if file is more than 1mb, I get 413 error.
I also extend the body parser size limit on
next.config.js
file.But I still get 413 error. If I send a request with postman, then it works.
Expected Behavior
When I want to send request body more than 1mb, I don't want to get the following 413 error.
To Reproduce
/api/upload
file:Client side code: