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

Unable to require graphqlUploadExpress module after the major bump to v15 #315

Closed junajan closed 2 years ago

junajan commented 2 years ago

Hi there,

we import this module in NodeJS using commonJS require method:

const { graphqlUploadExpress } = require('graphql-upload');

But after the major bump to v15 we started getting error:

Error [ERR_PACKAGE_PATH_NOT_EXPORTED]: No "exports" main defined in /Users/abc/dev/project/node_modules/graphql-upload/package.json

Which is thrown because there was removed main field in package.json.

Is there any other way how the graphqlUploadExpress should be imported now?

Also, thanks for spending your time and working on this module ;-)

jaydenseric commented 2 years ago

Thanks for the thanks!

This issue duplicates https://github.com/jaydenseric/graphql-upload/issues/305, see https://github.com/jaydenseric/graphql-upload/issues/305#issuecomment-1134736158 for an explanation and https://github.com/jaydenseric/graphql-upload/issues/305#issuecomment-1135285811 for the new way to write the import.

junajan commented 2 years ago

HI @jaydenseric - thanks for your reply.

I was originally trying this approach but it did not work because we import this module on multiple places so it was still throwing the same error (but from different place).

This one works now:

const graphqlUploadExpress = require('graphql-upload/graphqlUploadExpress.js');

Have a good day.

osipMax commented 2 years ago

Hi! I`m working with NestJS and Graphql and I need to upload files to Apollo Server. But after changing this package graphql showing this error Error: Cannot determine a GraphQL input type nullfor the "file". So can you help me, how should I specify the type of file in this case? Before updating to version v15 all worked as expected