Open HenriqueLimas opened 11 months ago
One solution that can be used is to clone (or tee) the req
Readable stream before doing anything with it and using that stream as the input to next handler. Although this is not ideal in cases where security checks (xss prevention) are made to make sure the input are secure or any other treatment of the req data.
Link to the code that reproduces this issue
https://github.com/HenriqueLimas/next-server-action-issue
To Reproduce
req
readable stream (Like formidable)Current vs. Expected behavior
Current The following error is shown:
Error: Unexpected end of form
Expected The action is executed successfully
Verify canary release
Provide environment information
Which area(s) are affected? (Select all that apply)
App Router
Additional context
On NodeJS env the error is throw by busboy during decoding. This is because the readable stream was already closed by previous middlewares/code logic and the logic as of now assumes that the readable stream is still open. Ideally there should be a different case when the readableStream is completed already. Maybe using some info form NextInternalRequestMeta