graphql-yoga icon indicating copy to clipboard operation
graphql-yoga copied to clipboard

File upload is broken with Nextjs

Open mstfash opened this issue 1 year ago • 3 comments

Describe the bug

File upload with yoga and nextjs works fine if its app router, but in pages legacy router it does not work as expected ... while using bodyParser: false it results with 500 error saying

TypeError: RequestInit: duplex option is required when sending a body.
    at new Request (node:internal/deps/undici/undici:7368:19)

and if I remove bodyParser:false I get a file response that is missing most of its built-in functions like stream and arrayBuffer

Your Example Website or App

none

Steps to Reproduce the Bug or Issue

1- Work with yoga (latest version) example and nextjs 14 2- Toggle bodyParser true/false

Expected behavior

for upload to work as expected

Screenshots or Videos

No response

Platform

  • OS: macOS
  • NodeJS: v18.18.0
  • @graphql-yoga/* version(s): 5.1.1
  • Nextjs: 14.1.0

Additional context

No response

mstfash avatar Feb 07 '24 10:02 mstfash

Hi @mstfash and thank you for the report

Sorry but I'm not adding a lot here but just labeling it according to our new Contribution Guide and issue flow.

It seems already got into stage 1 thanks to your reproduction! Thank you for that!

Now in order to advance to stage 2 we'll need a failing test, would be great if someone could help progress the issues through the stages.

Thank you and sorry that this comment is not a complete solution (yet).

EmrysMyrddin avatar Feb 07 '24 15:02 EmrysMyrddin

Any status? I can't upload file via mutation in nestjs.

Luferov avatar Aug 08 '24 17:08 Luferov

Not yet but as @EmrysMyrddin said above, a reproduction or a PR with a failing test would be better for us or anyone else(who wants to contribute) in order to proceed faster.

ardatan avatar Aug 08 '24 19:08 ardatan