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

GraphQL 16 support #1583

Closed
1 of 6 tasks
eturino opened this issue Feb 9, 2022 · 11 comments
Closed
1 of 6 tasks

GraphQL 16 support #1583

eturino opened this issue Feb 9, 2022 · 11 comments

Comments

@eturino
Copy link

eturino commented Feb 9, 2022

Feature description

postgraphile requires graphql version 15 or lower. Since graphql 16 has been stable for a while, I'd love to see it being supported by postgraphile.

Supporting development

I [tick all that apply]:

  • am interested in building this feature myself
  • am interested in collaborating on building this feature
  • am willing to help testing this feature before it's released
  • am willing to write a test-driven test suite for this feature (before it exists)
  • am a Graphile sponsor ❤️
  • have an active support or consultancy contract with Graphile
@benjie
Copy link
Member

benjie commented Feb 9, 2022

@barbalex
Copy link

I am getting version conflicts in my projects because I am using:

  • apollo
  • gatsby
  • postgraphile

Not a rare combination probably.

Some of these dependencies expect graphql v16.

So I tried to solve the conflicts by:

  • installing graphql v16
  • adding it as an override

Now I get this error when a query is executed:

PostGraphile v4.12.11 server listening on port 5000 🚀

  ‣ GraphQL API:         http://localhost:5000/graphql
  ‣ GraphiQL GUI/IDE:    http://localhost:5000/graphiql
  ‣ Postgres connection: postgres://postgres:[SECRET]@localhost/ae (watching)
  ‣ Postgres schema(s):  ae
  ‣ Documentation:       https://graphile.org/postgraphile/introduction/
  ‣ Node.js version:     v17.5.0 on linux x64
  ‣ Join Dovetail in supporting PostGraphile development: https://graphile.org/sponsor/

* * *

Error: graphql@16 dropped long-deprecated support for positional arguments, please pass an object instead.
    at devAssert (/mnt/c/Users/alexa/ae2/node_modules/graphql/jsutils/devAssert.js:12:11)
    at Object.execute (/mnt/c/Users/alexa/ae2/node_modules/graphql/execution/execute.js:107:30)
    at /mnt/c/Users/alexa/ae2/node_modules/postgraphile/build/postgraphile/http/createPostGraphileHttpRequestHandler.js:718:61
    at /mnt/c/Users/alexa/ae2/node_modules/postgraphile/build/postgraphile/http/createPostGraphileHttpRequestHandler.js:106:20
    at /mnt/c/Users/alexa/ae2/node_modules/postgraphile/build/postgraphile/withPostGraphileContext.js:172:30
    at withAuthenticatedPgClient (/mnt/c/Users/alexa/ae2/node_modules/postgraphile/build/postgraphile/withPostGraphileContext.js:112:34)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async /mnt/c/Users/alexa/ae2/node_modules/postgraphile/build/postgraphile/http/createPostGraphileHttpRequestHandler.js:709:34
    at async Promise.all (index 0)
    at async graphqlRouteHandler (/mnt/c/Users/alexa/ae2/node_modules/postgraphile/build/postgraphile/http/createPostGraphileHttpRequestHandler.js:641:23)
An unexpected error occurred whilst processing 'graphqlRouteHandler'; this indicates a bug. The connection will be terminated.
TypeError: Cannot set properties of undefined (setting 'statusCode')
    at graphqlRouteHandler (/mnt/c/Users/alexa/ae2/node_modules/postgraphile/build/postgraphile/http/createPostGraphileHttpRequestHandler.js:810:39)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async /mnt/c/Users/alexa/ae2/node_modules/postgraphile/build/postgraphile/http/createPostGraphileHttpRequestHandler.js:347:17
Error: graphql@16 dropped long-deprecated support for positional arguments, please pass an object instead.
    at devAssert (/mnt/c/Users/alexa/ae2/node_modules/graphql/jsutils/devAssert.js:12:11)
    at Object.execute (/mnt/c/Users/alexa/ae2/node_modules/graphql/execution/execute.js:107:30)
    at /mnt/c/Users/alexa/ae2/node_modules/postgraphile/build/postgraphile/http/createPostGraphileHttpRequestHandler.js:718:61
    at /mnt/c/Users/alexa/ae2/node_modules/postgraphile/build/postgraphile/http/createPostGraphileHttpRequestHandler.js:106:20
    at /mnt/c/Users/alexa/ae2/node_modules/postgraphile/build/postgraphile/withPostGraphileContext.js:172:30
    at withAuthenticatedPgClient (/mnt/c/Users/alexa/ae2/node_modules/postgraphile/build/postgraphile/withPostGraphileContext.js:112:34)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async /mnt/c/Users/alexa/ae2/node_modules/postgraphile/build/postgraphile/http/createPostGraphileHttpRequestHandler.js:709:34
    at async Promise.all (index 0)
    at async graphqlRouteHandler (/mnt/c/Users/alexa/ae2/node_modules/postgraphile/build/postgraphile/http/createPostGraphileHttpRequestHandler.js:641:23)
An unexpected error occurred whilst processing 'graphqlRouteHandler'; this indicates a bug. The connection will be terminated.
TypeError: Cannot set properties of undefined (setting 'statusCode')
    at graphqlRouteHandler (/mnt/c/Users/alexa/ae2/node_modules/postgraphile/build/postgraphile/http/createPostGraphileHttpRequestHandler.js:810:39)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async /mnt/c/Users/alexa/ae2/node_modules/postgraphile/build/postgraphile/http/createPostGraphileHttpRequestHandler.js:347:17

@barbalex
Copy link

I now tried overriding with graphql v15.6.1 or 15.7.2. But then data queries are simply never answered: network status remains pending.

@barbalex
Copy link

barbalex commented Nov 13, 2022

I uninstalled graphql again, deleted package-lock.json, emptied node_modules, ran npm i --legacy-peer-deps and ran npm ls graphql:

PS C:\Users\alexa\ae2> npm ls graphql
artdaten@1.7.21 C:\Users\alexa\ae2
├─┬ @apollo/client@3.7.1
│ ├─┬ @graphql-typed-document-node/core@3.1.1
│ │ └── graphql@16.6.0 deduped
│ ├── graphql@16.6.0
│ └─┬ subscriptions-transport-ws@0.9.19
│   └── graphql@16.6.0 deduped
├─┬ gatsby-plugin-image@3.0.0
│ └─┬ gatsby-plugin-utils@4.0.0
│   └── graphql@16.6.0 deduped
├─┬ gatsby@5.0.1
│ ├─┬ @graphql-codegen/add@3.2.1
│ │ └── graphql@16.6.0 deduped
│ ├─┬ @graphql-codegen/core@2.6.5
│ │ ├─┬ @graphql-tools/schema@9.0.9
│ │ │ ├─┬ @graphql-tools/merge@8.3.11
│ │ │ │ ├─┬ @graphql-tools/utils@9.1.0
│ │ │ │ │ └── graphql@16.6.0 deduped invalid: "^14.7.0 || ^15.3.0" from node_modules/express-graphql, ">=0.9 <0.14 || ^14.0.2 || ^15.4.0" from node_modules/graphile-build, ">=0.9 <0.14 || ^14.0.2 || ^15.4.0" from node_modules/postgraphile-core, ">=0.9 <0.14 || ^14.0.2 || ^15.4.0" from node_modules/graphql-parse-resolve-info
│ │ │ │ └── graphql@16.6.0 deduped invalid: "^14.7.0 || ^15.3.0" from node_modules/express-graphql, ">=0.9 <0.14 || ^14.0.2 || ^15.4.0" from node_modules/graphile-build, ">=0.9 <0.14 || ^14.0.2 || ^15.4.0" from node_modules/postgraphile-core, ">=0.9 <0.14 || ^14.0.2 || ^15.4.0" from node_modules/graphql-parse-resolve-info                                                                                                                                                                                 
│ │ │ ├─┬ @graphql-tools/utils@9.1.0
│ │ │ │ └── graphql@16.6.0 deduped invalid: "^14.7.0 || ^15.3.0" from node_modules/express-graphql, ">=0.9 <0.14 || ^14.0.2 || ^15.4.0" from node_modules/graphile-build, ">=0.9 <0.14 || ^14.0.2 || ^15.4.0" from node_modules/postgraphile-core, ">=0.9   ├─┬ graphile-utils@4.12.3
  │ └── graphql@15.8.0
  ├── graphql@15.8.0
  └─┬ postgraphile-core@4.12.3
    └── graphql@16.6.0 deduped invalid: "^14.7.0 || ^15.3.0" from node_modules/express-graphql, ">=0.9 <0.14 || ^14.0.2 || ^15.4.0" from node_modules/graphile-build, ">=0.9 <0.14 || ^14.0.2 || ^15.4.0" from node_modules/postgraphile-core

npm ERR! code ELSPROBLEMS
npm ERR! invalid: graphql@16.6.0 C:\Users\alexa\ae2\node_modules\graphql

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\alexa\AppData\Local\npm-cache\_logs\2022-11-13T14_17_05_936Z-debug-0.log

@barbalex
Copy link

2022-11-13_15h29_14

@benjie
Copy link
Member

benjie commented Nov 14, 2022

Yes; this difficulty is why we’ve not managed to add v16 support on top of v0.8-v15 support; too many interfaces broke.

@benjie
Copy link
Member

benjie commented Nov 14, 2022

If you’d like to help, please fork graphile/graphile-engine#764 and apply the relevant changes required to pass CI with both old and new GraphQL versions.

@barbalex
Copy link

barbalex commented Nov 15, 2022

...or revert updates in other libraries using graphql and wait for v5 of postgraphile. Which is probably what I will do.

Thanks for great help and building this tool, @benjie

@barbalex
Copy link

In case others run into this: The conflict was caused by gatsby v5 requiring graphql v16. If you use gatsby and postgraphile, you need to stay with gatsby v4.

@barbalex
Copy link

barbalex commented Nov 18, 2022

In case of conflicts created by other libraries expecting graphql v16 while postgraphile expects v15: a workaround is to remove postgraphile from package.json file by either creating a new project for the backend or using docker.

When postgraphile lives in it's own world no one else cares about it's graphql version 😆

@benjie benjie added the 🔁 revisit-in-v5 Not happy with this behaviour, but changing it is a breaking change. label Jan 3, 2023
@benjie benjie added 🔮 fixed-in-v5 and removed 🔁 revisit-in-v5 Not happy with this behaviour, but changing it is a breaking change. labels Sep 29, 2023
@benjie
Copy link
Member

benjie commented Sep 29, 2023

V5 is built on top of GraphQL v16

@benjie benjie closed this as completed Sep 29, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants