You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Submitting a JSON request body of 300KB results in the below server error output:
Error: {"errors":[{"name":"JSON_SIZE_EXCEEDED","message":"json object exceeds 0B"}]}
at getProperError (home/project/node_modules/next/dist/lib/is-error.js:41:12)
at NextNodeServer.renderToResponseImpl (home/project/node_modules/next/dist/server/base-server.js:1968:53)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async NextNodeServer.pipeImpl (home/project/node_modules/next/dist/server/base-server.js:921:25)
at async NextNodeServer.handleCatchallRenderRequest (home/project/node_modules/next/dist/server/next-server.js:272:17)
at async NextNodeServer.handleRequestImpl (home/project/node_modules/next/dist/server/base-server.js:817:17)
at async invokeRender (home/project/node_modules/next/dist/server/lib/router-server.js:173:21)
at async handleRequest (home/project/node_modules/next/dist/server/lib/router-server.js:350:24)
at async requestHandlerImpl (home/project/node_modules/next/dist/server/lib/router-server.js:374:13)
at async Server.requestListener (home/project/node_modules/next/dist/server/lib/start-server.js:141:13)
After digging into documentation, it seems this is expected behavior and the error message is just unhelpful and the documentation is lacking in what the default limit may be set to. After the error is reproduced, you can resolve it by overriding the default jsonSize limit.
It would be nice to see an improved error message (which includes the actual limit) and documentation updated for what the default limits are set to. It seems that the underlying body-parser has a default limit of 100KB.
Lastly, for our simple use case, I was able to remove our app dependency on next-runtime with the following prior to discovering the jsonSize limit solution above:
Got it, so the error is that the message says "exceeds 0B", while in fact it exceeded the default of 100KB which is defined by body-parser. Thanks for reporting.
@smeijer yes, but just to be very clear, it'd be helpful to mention and link out to the exact documentation for the configuration value that would need to be modified. This wouldn't be so necessary except that the traceback is totally unhelpful (perhaps the fault of Next) and doesn't lead you to next-runtime or body-parser. Debugging this was a series of shots in the dark before it was isolated to use of next-runtime and I just happened to find the applicable documentation.
Submitting a JSON request body of 300KB results in the below server error output:
After digging into documentation, it seems this is expected behavior and the error message is just unhelpful and the documentation is lacking in what the default limit may be set to. After the error is reproduced, you can resolve it by overriding the default jsonSize limit.
It would be nice to see an improved error message (which includes the actual limit) and documentation updated for what the default limits are set to. It seems that the underlying body-parser has a default limit of 100KB.
Lastly, for our simple use case, I was able to remove our app dependency on next-runtime with the following prior to discovering the jsonSize limit solution above:
The text was updated successfully, but these errors were encountered: