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.43k stars 131 forks source link

Use both graphql-upload and Apollo uploads. #278

Closed ArthurRF closed 2 years ago

ArthurRF commented 2 years ago

Hey!

I'm having a problem while using the graphqlUploadExpress({ maxFileSize: 10000000, maxFiles: 10 }) as a middleware in my app because the only way I found to make it work was disabling the uploads in my ApolloServer configs, as shown below: const apolloServer = new ApolloServer({ uploads: false, schema })

The question is: Is there any way that I can use the graphql-upload middleware without needing to stop the Apollo uploads?

I use the Apollo uploads for some important REST routes in my app, so it's not an option to migrate it all to GraphQL-upload in this moment.

Thanks for your time!

jaydenseric commented 2 years ago

Well, you could compose your Express middleware for each route to do whatever you like, so I find the question a bit confusing.

Keep in mind that the Apollo Server uploads feature implemented graphql-upload under the hood, which they didn't keep up to date. You should get off that and use the up to date graphql-upload ASAP. Migrating your whole codebase to one graphql-upload installation should be pretty easy; it's certainly what I would do. You have no choice anyway, because the build-in uploads integration is removed in current Apollo Server versions. I don't understand teams/people that keep dependencies out of date on purpose.

Hope that helps :)