Apollo-tooling: Error: Cannot find module core-js/proposals/array-flat-and-flat-map

Created on 2 Feb 2019  ยท  13Comments  ยท  Source: apollographql/apollo-tooling

Intended outcome:

Trying to install/run a serverless app using apollo-server-lambda.

Actual outcome:

When running apollo-server-lambda v2.3.3, I get an error when running the server in apollo-env. That error looks like this:

'Error: Cannot find module \'core-js/proposals/array-flat-and-flat-map\'',

I think the issue is that apollo-env pins the core-js dependency to ^3.0.0-beta.3, which currently resolves to 3.0.0-beta.12. From the looks of it, the issue is that, between beta.11 to beta.12, the array-flat-and-flat-map.js has moved?

How to reproduce the issue:

I think running any app with apollo-server-lambda v2.3.3 should do it.

Versions

apollo-env 0.3.0

Most helpful comment

For anyone who is still running into this bug, if an apollo-server-* package was installed prior to the above fix, the version of core-js with the breaking change is likely baked into the project's package-lock.json or yarn.lock as a transitive dependency, as that is what these files intend to do: Achieve reproducible installs regardless of any new transitive dependency which might fulfill semver desires but inadvertently break a build.

You can inspect the lock files manually to see if that is the case (e.g. search for [email protected]), but running npm install [email protected] (or yarn add [email protected]) again should cause the package manager to update the transitive dependency resolution in the lock-file.

All 13 comments

Thanks for submitting this issue @mtmckenna, I was about to do the same.

We have an example of deploying apollo-server with ZEIT Now and the pinning issue caused our example โ€“ which also allows users to initialize projects from โ€“ to break and make our CI fail.

I highly suggest pinning a specific version (no ^) when using beta versions to avoid unnecessary breakage.

I had to install and pin a specific core-js version to fix this: https://github.com/zeit/now-examples/commit/2583cd773b6e6e04f827c1d899689ef913e237ad

Looks like a PR was submitted! #961

CI stopped working suddenly here with this error some time on Friday midday PST .. very serious!!! We are using apollo graphql which I guess depends on this, but I thought we had all our versions locked in package.json, need to understand better why we were impacted....

Thanks for jumping on this so quickly! We've pinned the core-js dep and rereleased. Fixes should be in [email protected]

I believe apollo server express (and likely other apollo-server-x) need to be updated as part of this fix - the dep chain looks like so and as such, I can't update to [email protected]

[email protected]
  โ””โ”€โ”ฌ [email protected]
    โ””โ”€โ”ฌ @apollographql/[email protected]
      โ””โ”€โ”€ [email protected]

Can you rollback?
Can you test before publishing breaking changes?
This damn issue crashed my production website.

Actually I forced to use "apollo-server-express": "2.2.2"

I cannot believe that old version is hitting this bug, WTF?

@nodegin can you please clarify? Did pinning to version 2.2.2 _fix_ the problem? Or was it broken because you already had it pinned to that version? Going to try to reproduce to confirm while I wait to hear from you.

@nodegin I've confirmed at least this much, if you have any information otherwise please let me know

[email protected] gets [email protected] (12->13 had a breaking change)

[email protected] gets a pinned version of core-js via
@apollographql/[email protected] -> [email protected] -> [email protected]

For anyone who is still running into this bug, if an apollo-server-* package was installed prior to the above fix, the version of core-js with the breaking change is likely baked into the project's package-lock.json or yarn.lock as a transitive dependency, as that is what these files intend to do: Achieve reproducible installs regardless of any new transitive dependency which might fulfill semver desires but inadvertently break a build.

You can inspect the lock files manually to see if that is the case (e.g. search for [email protected]), but running npm install [email protected] (or yarn add [email protected]) again should cause the package manager to update the transitive dependency resolution in the lock-file.

I still have this issue

[email protected]
โ”‚  โ””โ”€ [email protected]
โ”œโ”€ [email protected]
โ”‚  โ””โ”€ [email protected]
โ”œโ”€ [email protected]
โ”‚  โ””โ”€ [email protected]
โ”œโ”€ [email protected]
โ”‚  โ””โ”€ [email protected]
โ”œโ”€ [email protected]
โ”‚  โ””โ”€ [email protected]
โ”œโ”€ [email protected]
โ”‚  โ””โ”€ [email protected]
โ”œโ”€ [email protected]
โ”‚  โ””โ”€ [email protected]
โ”œโ”€ [email protected]
โ”‚  โ””โ”€ [email protected]
โ”œโ”€ [email protected]
โ”‚  โ””โ”€ [email protected]
โ”œโ”€ [email protected]
โ”‚  โ””โ”€ [email protected]
โ”œโ”€ [email protected]
โ”‚  โ””โ”€ [email protected]
โ”œโ”€ [email protected]
โ”‚  โ””โ”€ [email protected]
โ”œโ”€ [email protected]
โ”‚  โ””โ”€ [email protected]
โ”œโ”€ [email protected]
โ”‚  โ””โ”€ [email protected]
โ”œโ”€ [email protected]
โ”‚  โ””โ”€ [email protected]
โ”œโ”€ [email protected]
โ”‚  โ””โ”€ [email protected]
โ””โ”€ [email protected]
   โ”œโ”€ @babel/[email protected]
   โ”‚  โ””โ”€ [email protected]
   โ”œโ”€ [email protected]
   โ”‚  โ””โ”€ [email protected]
   โ”œโ”€ [email protected]
   โ”‚  โ””โ”€ [email protected]
   โ”œโ”€ [email protected]
   โ”‚  โ””โ”€ [email protected]
   โ”œโ”€ [email protected]

My installation installs core-js 2.6.5. This is one hell of a rabbit hole with "babel-core": "7.0.0-bridge.0",. I'm surprised I haven't run into this more often

@mschipperheyn I don't quite follow, re: "babel-core": "7.0.0-bridge.0"

This much looks correct to me:

[email protected]
โ”‚  โ””โ”€ [email protected]

Could you paste the error or share some more info? A reproduction would be great if you're able to provide one.

For me, I had core-js as a root dependency, and it seemed apollo-env was using that rather than the local one. I solved this with npm i core-js@3
bad:

| `-- [email protected]
|   `-- @apollographql/[email protected]
|     `-- [email protected]
|       `-- [email protected]
+-- [email protected]

good:

| `-- [email protected]
|   `-- @apollographql/[email protected]
|     `-- [email protected]
|       `-- [email protected]
+-- [email protected]
Was this page helpful?
0 / 5 - 0 ratings

Related issues

pietmichal picture pietmichal  ยท  4Comments

clayne11 picture clayne11  ยท  3Comments

rasmusprentow picture rasmusprentow  ยท  3Comments

hashlin picture hashlin  ยท  4Comments

fenech picture fenech  ยท  3Comments