Next.js 16.0.0 Stable Version API Response Maximum Size Limit Config Error
Unanswered
Spectacled Caiman posted this in #help-forum
Spectacled CaimanOP
When I was using the older Next.js version 15.5.6, all requests sent to the /api/photos endpoint were working successfully. However, now the API can’t parse them — it seems there’s some kind of size limitation.
Even though I added this to my next.config.js:
serverActions: {
bodySizeLimit: '15mb',
},
the issue still persists. When I reverted back to the older Next.js version, everything started working again.
Do I need to set an additional configuration for this in Next.js v16?
Even though I added this to my next.config.js:
serverActions: {
bodySizeLimit: '15mb',
},
the issue still persists. When I reverted back to the older Next.js version, everything started working again.
Do I need to set an additional configuration for this in Next.js v16?
7 Replies
@Spectacled Caiman When I was using the older Next.js version 15.5.6, all requests sent to the /api/photos endpoint were working successfully. However, now the API can’t parse them — it seems there’s some kind of size limitation.
Even though I added this to my next.config.js:
serverActions: {
bodySizeLimit: '15mb',
},
the issue still persists. When I reverted back to the older Next.js version, everything started working again.
Do I need to set an additional configuration for this in Next.js v16?
can you make a minimum reproducible repository showcaing the bug despite setting bodySizeLimit?
@alfonsüs ardani can you make a minimum reproducible repository showcaing the bug despite setting bodySizeLimit?
Spectacled CaimanOP
Unfortunately, I don't have enough time to do that. For now, I've reverted to the version prior to v16. I'm not sure if it will work, but the project runs through Cloudflare ZeroTrust, and downgrading the version fixed the error. Without making any code changes.
okay
Magnolia Warbler
I did that and I sent a 5mb json file to server action and it worked. It's something else. It's not parsing the JSON properly. I keep getting weird parse errors
@alfonsüs ardani can you make a minimum reproducible repository showcaing the bug despite setting bodySizeLimit?
Magnolia Warbler
wait, if you're using an API endpoint, what would server action body size have to do with anything?
@Magnolia Warbler I did that and I sent a 5mb json file to server action and it worked. It's something else. It's not parsing the JSON properly. I keep getting weird parse errors
Spectacled CaimanOP
Yes, the error I got was also “JSON parsing failed.”
@Magnolia Warbler wait, if you're using an API endpoint, what would server action body size have to do with anything?
Spectacled CaimanOP
Yes, it goes to the API endpoint /api/photos, but I tested it and it did not recognize the limit settings specified for the API in the next.config.js file.