-
Notifications
You must be signed in to change notification settings - Fork 319
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
Cannot query field "node" on type "Link". #69
Comments
Yes, subscriptions don't currently work for the react-apollo guide. The backend node (graphql-js) tutorial/code is out of sync with the frontend (react-apollo) tutorial/code. I went through both guides yesterday and had the same problem. The issue appears to be due to a change to the Subscription.js resolver for the backend tutorials 20 days ago: howtographql/graphql-js@d02a632#diff-715d58f925a8194a35799e705bd4837f node() was added to the end of the expressions, and that breaks the frontend subscription gql statements. The fix is to remove references to node in 3 places in LinkList.js:
should just be:
Here is my working LinkList component with all these changes made: If this is the preferred way to fix this, I can submit pull requests for the react-apollo repo and the two tutorial .md files that incorrectly reference node: https://www.howtographql.com/graphql-js/7-subscriptions/
should be
https://www.howtographql.com/react-apollo/8-subscriptions/ Apply changes to LinkList.js I did here: |
thanks a lot for this @sschottler - i think this will definitely benefit myself and others working through this guide 👍. This was really the only issue I ran into with my deployment... f.w.i.w. - i am also considering upgrading from there are some good examples of how to do this linked in the issue, but I have not tried them with this guide's frontend yet. Would be great for the how-to-graphql guide to be updated if Apollo2 server is indeed the direction...or others in the community try this out, please feel free to share your forks 😉 . Also, I think for many of us, including a guide on configuring Traefik or some reverse proxy w/ docker-compose is also quite useful alongside this (I am happy to contribute this if it helps). I understand the guide aims to get folks running and understand the concepts of GraphQL...but for many of us, the next step is deploying our frontend to Zeit/Netlify/etc. where HTTPS will be required to talk to the backend (and thus configuring a reverse proxy alongside the backend becomes crucial). I'll be happy to chime in if an issue is opened on this having run through this on DigOcean recently... |
@sschottler good catch, it'd be awesome if either you or @priley86 could open a PR to fix it! |
I created two pull requests with the necessary changes: #70 Thanks! |
That's amazing, thanks for contributing and hopefully it'll encourage you to keep collaborating with this great OSS community 😀 |
I have another question realted to the same section of the tutorial. It states that I should use the playground to create a post and then watch the app update in realtime. Will this be possible at all, seing as we already implemented a login and that the request requires a token? |
Getting the following subscription errors in console after running through this guide:
Everything else in the app seems to work fine. Prisma and Graphql running on a node10-alpine image. No issues hitting the Prisma/Graphql playgrounds.
The text was updated successfully, but these errors were encountered: