Open hafaiedhmehdy opened 3 months ago
Busboy has another major issue where it looks for the Content-Type header incorrectly. In busboy/lib/index.js:53:11
, it uses cfg.headers['content-type']
, which will always return undefined
. The correct way to retrieve the Content-Type header in Next.js is by using req.headers.get('content-type')
. Just tagging you in jaydenseric, since it's your original project. And perhaps pass this down to the busboy team.
Edit: it's quite a mess, Next.js API's too different. :'( Another update: I'll be working towards achieving full compatibility between this repository's goal/function and Next.js.
This solution addresses several issues, including the "Missing Content-Type" error caused by case-sensitivity in Busboy. My implementation ensures compatibility and smooth file upload functionality in Next.js environments.
This is an alpha version, and I'm looking for feedback and criticism to help improve it further. It's currently missing acknowledgements, so I welcome people to add themselves before I do, as I'm quite busy.
You can check out the solution here: graphql-upload-nextjs.
Next.js API routes using
graphql-upload-ts
may encounter a "Missing Content-Type" error due to a case-sensitivity issue in the underlying Busboy dependency. Normalizing theContent-Type
header before passing it to Busboy will resolve this issue.