jaydenseric / graphql-upload

Middleware and an Upload scalar to add support for GraphQL multipart requests (file uploads via queries and mutations) to various Node.js GraphQL servers.
https://npm.im/graphql-upload
MIT License
1.42k stars 131 forks source link

Issue when upgrading to Apollo Server 4 and Fastify 4 #361

Closed codejet closed 1 year ago

codejet commented 1 year ago

Hi,

I use Apollo Server with Fastify and graphql-upload and am currently trying to upgrade to Apollo Server 4, Fastify 4 and graphql-upload 16.

When upgrading to the previous version 3 of Apollo and Fastify, using graphql-upload 12, I followed this example for uploads which worked right away: https://www.apollographql.com/docs/apollo-server/v3/data/file-uploads/#integrating-with-fastify.

But when trying to upgrade to version 4, I can't upload files anymore. Without making any other changes apart from the upgrades, the data source server suddenly complained about an empty (or non-existent) Content-Type header. I tried adding it manually incl. a generated boundary (via FormData). But then the server started complaining about a missing query parameter. The transmitted query is exactly the same as before though.

I also tried adding fastify-multipart. But then graphql-upload's processRequest started throwing an error. Or rather, the underlying busboy package did: Error: Unexpected end of form at Multipart._final (node_modules/busboy/lib/types/multipart.js:588:17). Wasn't able to fix that either unfortunately.

codejet commented 1 year ago

Closing due to inactivity. Also figured that even downgrading graphql-upload there is still an issue. So, it's probably due to a change in one of the other deps.