Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[2.10.0] incompatibility with pre-graphql@14.x #4066

Closed
oguimbal opened this issue May 5, 2020 · 8 comments
Closed

[2.10.0] incompatibility with pre-graphql@14.x #4066

oguimbal opened this issue May 5, 2020 · 8 comments
Labels
🪲 bug 🌹 has-reproduction ❤ Has a reproduction in Glitch, CodeSandbox or Git repository.

Comments

@oguimbal
Copy link

oguimbal commented May 5, 2020

TLDR Reproduction repo here ... just try to launch main.js, you'll see.

The latest release of apollo-server-core (2.13.0) should have been a major version, I guess.

apollo-server-express@2.12.0 depends on apollo-server-core@2.12.0 or higher minor version (i.e. "apollo-server-core": "^2.12.0"), which now makes it install 2.13.0.

If like me you're stuck with an older graphql version (graphql@0.13.2), the later release breaks everyting: Cannot find module 'graphql/validation/rules/PossibleTypeExtensions'

Workaround : Force install the older apollo-server-core version (i.e. put "apollo-server-core": "2.12.0" in your package.json)

Additionally, it should be mentioned that this release no longer supports older graphql versions...

Thanks :)

@techerjeansebastienpro
Copy link

Maybe you mean "apollo-server-core@2.12.0" instead of "graphql-server-core@2.12.0"

@oguimbal
Copy link
Author

oguimbal commented May 5, 2020

Yes, sorry I wrote that a bit too fast. Thats fixed :)

@abernix
Copy link
Member

abernix commented May 5, 2020

I won't argue that this is (inadvertently!) breaking, but the change that is causing the breakage for you was not introduced in v2.13.0, so the claim that apollo-server-core@2.13.0 should have been a major isn't quite right.

Something has gone awry, but to provide some clarity, I'll copy and paste the error here, since it's only otherwise visible after running the reproduction you provided:

$ node index.js
internal/modules/cjs/loader.js:985
  throw err;
  ^

Error: Cannot find module 'graphql/validation/rules/PossibleTypeExtensions'
Require stack:
- /Users/jesse/Dev/apollo/repros/issue-4066/node_modules/apollo-engine-reporting/node_modules/apollo-graphql/lib/schema/buildSchemaFromSDL.js
- /Users/jesse/Dev/apollo/repros/issue-4066/node_modules/apollo-engine-reporting/node_modules/apollo-graphql/lib/schema/index.js
- /Users/jesse/Dev/apollo/repros/issue-4066/node_modules/apollo-engine-reporting/node_modules/apollo-graphql/lib/index.js
- /Users/jesse/Dev/apollo/repros/issue-4066/node_modules/apollo-engine-reporting/dist/agent.js
- /Users/jesse/Dev/apollo/repros/issue-4066/node_modules/apollo-server-core/dist/ApolloServer.js
- /Users/jesse/Dev/apollo/repros/issue-4066/node_modules/apollo-server-core/dist/index.js
- /Users/jesse/Dev/apollo/repros/issue-4066/node_modules/apollo-server-express/dist/index.js
- /Users/jesse/Dev/apollo/repros/issue-4066/index.js
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:982:15)
    at Function.Module._load (internal/modules/cjs/loader.js:864:27)
    at Module.require (internal/modules/cjs/loader.js:1044:19)
    at require (internal/modules/cjs/helpers.js:77:18)
    at Object.<anonymous> (/Users/jesse/Dev/apollo/repros/issue-4066/node_modules/apollo-engine-reporting/node_modules/apollo-graphql/lib/schema/buildSchemaFromSDL.js:9:34)
    at Module._compile (internal/modules/cjs/loader.js:1158:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1178:10)
    at Module.load (internal/modules/cjs/loader.js:1002:32)
    at Function.Module._load (internal/modules/cjs/loader.js:901:14)
    at Module.require (internal/modules/cjs/loader.js:1044:19) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    '/Users/jesse/Dev/apollo/repros/issue-4066/node_modules/apollo-engine-reporting/node_modules/apollo-graphql/lib/schema/buildSchemaFromSDL.js',
    '/Users/jesse/Dev/apollo/repros/issue-4066/node_modules/apollo-engine-reporting/node_modules/apollo-graphql/lib/schema/index.js',
    '/Users/jesse/Dev/apollo/repros/issue-4066/node_modules/apollo-engine-reporting/node_modules/apollo-graphql/lib/index.js',
    '/Users/jesse/Dev/apollo/repros/issue-4066/node_modules/apollo-engine-reporting/dist/agent.js',
    '/Users/jesse/Dev/apollo/repros/issue-4066/node_modules/apollo-server-core/dist/ApolloServer.js',
    '/Users/jesse/Dev/apollo/repros/issue-4066/node_modules/apollo-server-core/dist/index.js',
    '/Users/jesse/Dev/apollo/repros/issue-4066/node_modules/apollo-server-express/dist/index.js',
    '/Users/jesse/Dev/apollo/repros/issue-4066/index.js'
  ]
}

As you can see from the error, this is happening as a result of the apollo-graphql package — which is an external package that lives in the apollo-tooling repository.

Specifically, the commit which introduced this was apollographql/apollo-tooling@3a6b11a which would have been released into apollo-graphql@0.4.0 on January 30th of this year. Then, Apollo Server's apollo-engine-reporting package — which is where the dependency is coming from in your case — would have made it into apollo-server-core@2.10.0, which was released on February 6.

That's all to say, this should have surfaced as a breaking change for you a while ago — unless you've just upgraded from an older version recently? (Again, it would have been released on February 6 and you're the first to report it, it would seem.) That's not to say it should have been a breaking change — it was certainly unintended.

While I'd love to know what the reason is for being "stuck" on graphql@0.13.2, I think we can still resolve this though and maintain compatibility with it (as is intended).

Would you consider PRing a change to the apollo-graphql package within the apollo-tooling repository which makes switches to using a conditional-require for the PossibleTypeExtensions (rather than an import) and also doesn't include the PossibleTypeExtensions rule in the skippedSDLRules if it's not able to find it? I suspect that would do the trick for you, and I think we could get that published relatively quickly if you could take the initiative.

@abernix abernix changed the title apollo-server-core@2.13.0 release breaks apollo-server-express@2.12 [2.10.0] incompatibility with pre-graphql@14.x May 5, 2020
@abernix abernix added 🪲 bug 🌹 has-reproduction ❤ Has a reproduction in Glitch, CodeSandbox or Git repository. labels May 5, 2020
@oguimbal
Copy link
Author

oguimbal commented May 6, 2020

@abernix Thanks for the clarification.

No, nothing has changed on our side... but our build pipeline started crashing without apparent reason just a few minutes after the release of 2.13.0.

I'm pretty sure it was not intended, and my comment was by no mean being a critisism... I'm sorry if it might have been misunderstood as some kind of arrogance.

As for why I'm stuck with graphql@0.13.2, that is because we use join-monster, that uses a mechanism to propagate metadatas which is broken after this version of graphql-js (see this issue )

Sure, I will be happy to prepare a PR !

nb: Thanks for the "get that published quickly" part, but there is no hurry - the workaround I mentioned mitigates this issue.

@abernix
Copy link
Member

abernix commented May 6, 2020

Good to know! And thanks for considering a PR. I'm still quite perplexed why this wasn't breaking a while ago and that it would have just broken for you on publish like that. I must be missing something in my diagnosis, but I'm glad that I think we can fix it.

Having a package-lock.json (or yarn.lock) in your project that you're building should help prevent that sort of surprise, or at the very least should make it easier to debug by allowing us to look at the diff between lock files during an upgrade.

No worries on the communication — I'm just trying to clarify and debug out-loud. We do try quite hard to not be actively breaking things, so I just want to make sure we are able to defend the releases whenever possible. 😉

Full disclosure, we don't have the matrix of tests of various graphql versions in place within our CI to not regress here inadvertently. There very well may have been a particular commit that caused this to happen (e.g. different import statements causing the module dependency tree to be slightly different, even.). If anyone wanted to introduce a setup to our CircleCI testsuite that would allow us to test against multiple versions (within each Node.js version) of graphql peer dependencies that would likely be tremendously beneficial! (Though I'm somewhat worried what it might reveal today, so this is likely best suited for the next major version once we tighten up our compatible versions.) On that note, we will be dropping support for graphql@0.13.x in Apollo Server 3.x (and possibly graphql@14.x too!), so perhaps something to prepare for yourselves!

@oguimbal
Copy link
Author

oguimbal commented May 6, 2020

Okay thanks, good to know. Upgrading would be really useful for us once union input types are released (which could be soon, if I remember well), so yes, I am starting to worry about join-monster incompatibility.

I'm not sure of what could have caused this, but the thing that I know is that if you take my reproduction repo (which has apollo-server-express@2.12.0 in package.json), and force npm i apollo-server-core@2.12.0, then the sample will run.

I submitted apollographql/apollo-tooling#1935 ... is that what you had in mind ?

We are extensively using apollo-server, so would be glad to help if I can. Just point me a direction when you think the time is right, I could try to help if I have some time.

@qizidev
Copy link

qizidev commented May 14, 2020

I also encountered the same problem, apollo-server-core 's peerDependencies supports graphql: ^0.12.0 || ^0.13.0 || ^14.0.0 || ^15.0.0, but apollo-graphql only supports graphql: ^14.2.1. Is this a conflict?

abernix added a commit to apollographql/apollo-tooling that referenced this issue Jun 8, 2020
As described in apollographql/apollo-server#4066,
older versions of `graphql` do not have this type.

Co-authored-by: Jesse Rosenberger <git@jro.cc>
@glasser
Copy link
Member

glasser commented Oct 20, 2022

Time has moved on and Apollo Server 4 supports and requires graphql-js v16.

@glasser glasser closed this as completed Oct 20, 2022
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 19, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
🪲 bug 🌹 has-reproduction ❤ Has a reproduction in Glitch, CodeSandbox or Git repository.
Projects
None yet
Development

No branches or pull requests

5 participants