jaydenseric / graphql-upload

Middleware and a scalar Upload 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 132 forks source link

Missing core-js/modules/es7.object.entries #103

Closed benwaffle closed 6 years ago

benwaffle commented 6 years ago
Error: Cannot find module 'core-js/modules/es7.object.entries'
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:581:15)
    at Function.Module._load (internal/modules/cjs/loader.js:507:25)
    at Module.require (internal/modules/cjs/loader.js:637:17)
    at require (internal/modules/cjs/helpers.js:20:18)
    at Object.<anonymous> (/Users/me/project/node_modules/apollo-upload-server/lib/middleware.js:14:1)
    at Module._compile (internal/modules/cjs/loader.js:689:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:700:10)
    at Module.load (internal/modules/cjs/loader.js:599:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:538:12)
    at Function.Module._load (internal/modules/cjs/loader.js:530:3)

using the latest version of apollo server

image
mike-marcacci commented 6 years ago

@benwaffle is this showing up when using apollo-server by itself (and its bundled apollo-upload-server) or are you using this library directly?

mike-marcacci commented 6 years ago

Assuming you're on apollo-upload-server 5.0.0, this should be present via the @babel/runtime#7.0.0-beta.40 dependency, which was used in the transpilation and testing.

jaydenseric commented 6 years ago

Babel recently had a big breaking change to the way Babel runtime works, and published it as a new prelease of the same major version as before (7). Packages that had specified the dependency with a ^ are now broken. We have a new version on the way, although you will need to do a little refactoring to the new API once it's out 🙏

jaydenseric commented 6 years ago

I think you won't have the issue with apollo-upload-server@6.0.0-alpha.1.

jaydenseric commented 6 years ago

Closing since the issue is fixed in the current release.

benwaffle commented 6 years ago

@mike-marcacci i'm using apollo-server, not apollo-upload-server directly

jaydenseric commented 6 years ago

@benwaffle you're stuck, nothing you can do but wait for Apollo to update their apollo-upload-server dependency.

jaydenseric commented 6 years ago

Well, actually you can make sure your package-lock.json has the exact dependency you need in it.

benwaffle commented 6 years ago

installing core-js manually fixes the issue

jwoptio commented 6 years ago

Using yarn you can specify specific sub-dependency versions using the resolutions block in your package.json:

ie:

  "resolutions": {
    "apollo-server-lambda/**/apollo-upload-server": "6.0.0-alpha.1"
  }
benwaffle commented 6 years ago

thanks, but i'm using npm

andyrichardson commented 6 years ago

@jaydenseric Apollo likely won't be updating to the 6.0.0-alpha.1 release due to dropped support for Node 6.x.

Is a 5.0.1 release with core-js an option?

abernix commented 6 years ago

@jaydenseric Would you accept a PR for a (proposed) v5.0.1, branched off the v5.0.0 tag which switches @babel/runtime to @babel/runtime-corejs2 (and the appropriate changes)?

I've staged what that would look like on a fork of this repository that I just made here: https://github.com/apollographql/apollo-upload-server/pull/1, and this seems to do the trick! (Though npm test is exhibiting failures both before and after my change, and I'm not sure what the reason is.)

jaydenseric commented 6 years ago

There are other, critical reasons to upgrade other than the recent dependency issue. People can crash your server process by sending a malformed request. Or a file too large, and other bugs fixed in the newest releases.

abernix commented 6 years ago

Those are certainly compelling reasons to upgrade!