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 v16 (or higher) does not work with Relay #3429

Closed
BiancaArtola opened this issue Dec 15, 2021 · 2 comments
Closed

Graphql v16 (or higher) does not work with Relay #3429

BiancaArtola opened this issue Dec 15, 2021 · 2 comments
Labels

Comments

@BiancaArtola
Copy link

Reporting issues with GraphQL.js

I am working on a React project using Relay and Graphql. This is my package json:


 "dependencies": {
    "axios": "^0.21.2",
    "mobx": "^6.3.5",
    "mobx-react-lite": "^3.2.1",
    "oidc-client": "^1.11.5",
    "react": "^17.0.2",
    "react-device-detect": "^2.0.0",
    "react-router-dom": "^5.3.0",
    "styled-components": "^5.3.3"
  },
  "devDependencies": {
    "@types/node": "^16.3.2",
    "@types/react": "^17.0.10",
    "@types/react-dom": "^17.0.7",
    "@types/react-relay": "^11.0.2",
    "@types/react-router-dom": "^5.1.7",
    "@types/relay-runtime": "^12.0.0",
    "@types/styled-components": "^5.1.10",
    "babel-plugin-relay": "^12.0.0",
    "env-cmd": "^10.1.0",
    "graphql": "^16.1.0",
    "prettier": "2.4.1",
    "react-app-rewired": "^2.1.8",
    "react-scripts": "^4.0.3",
    "relay-compiler": "^12.0.0",
    "relay-config": "^12.0.0",
    "react-dom": "^17.0.2",
    "react-relay": "^12.0.0",
    "relay-runtime": "^12.0.0",
    "typescript": "^4.3.2",
    "relay-compiler-language-typescript": "^15.0.0"
  },

After the Graphql update from version 15.x to 16.x Relay does not work anymore with Graphql. When I run yarn run relay, the following error appears:
image

@BiancaArtola BiancaArtola changed the title Graphql v16 (or major) does not work with Relay Graphql v16 (or higher) does not work with Relay Dec 15, 2021
@saihaj
Copy link
Member

saihaj commented Dec 16, 2021

Hey @BiancaArtola Supporting v16 at the moment with relay and relay-compiler-language-typescript is little bit challenging because:

  1. Back when we were migrating graphql-js to Typescript Convert flow types to TS #2828 we decided to drop support for flow RFC: Do Flow types still need to be exported after the TS Conversion? #2832. And relay < v12 is uses Flow. So the challenge to upgrade there is we need to get Flow types in order to support graphql@v16.
  2. Which brings us to error you are getting. With relay-compiler-language-typescript that directly depends on relay-compiler and since it doesn't support v16 that is why you get that TS error. See Invalid AST Node error with graphql@16 relay-tools/relay-compiler-language-typescript#507

With upcoming relay@13 release the compiler is written in rust and to my knowledge it doesn't depend on graphql-js and based on these release notes it support TS code generation out of the box facebook/relay#3182

So far the only major project I have seen is impacted with Flow types not being available with graphql-js is relay. FWIW I think just waiting for stable relay@13 is better idea.

@BiancaArtola
Copy link
Author

Thanks for the response @saihaj. I will wait for relay@13, thanks

@saihaj saihaj closed this as completed Dec 16, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants