I have a fully operational graphql endpoint using relay modern but I’m struggling to use it from within expo.
Are there any caveats on how to get things up and running? I’m able to query the schema file from the graphql endpoint, but I can’t seem to get expo to read it as well, or do I need a hard copy of the schema?
Searching Google for “expo.io graphql relay modern” yields only results using apollo or other third party libs…
Any help or pointers in the right direction is greatly appreciated!
Hi, what kind of problems are you having? Like specifically, is there some code you are running that is causing an exception?
sorry for the delay, I got super occupied.
I’m currently giving it another try by following the instructions I can find on the Expo FAQ.
I’m already bumping into this issue (pbbly minor, but still):
when running the following npm install command in a blank expo project (I added the dependencies myself based on the npm warnings)
npm install graphql graphql-relay react-relay relay-devtools babel-plugin-relay react relay-compiler
I get the following error:
npm WARN email@example.com requires a peer of graphql@^0.5.0 || ^0.6.0 || ^0.7.0 || ^0.8.0-b || ^0.9.0 || ^0.10.0 || ^0.11.0 but none is installed. You must install peer dependencies yourself.
The graphql version installed is @0.12.3 so there seems to be an issue with graphql-relay itself.
I’ll continue trying things out and keep you posted here.
So far I reported 3 issues with underlying node modules:
- fbjs-scripts still uses gulp-util -> #278
- react-native still depends on connect 2.x which is deprecated -> #17534 -> seems fixed
- graphql-relay doesn’t detect firstname.lastname@example.org -> #193
I’ll try continuing the babel setup to see how far I can get…
so far my local project seems to run (I’m not yet using the graphql api) but I still get the following warnings in the Expo console:
Warning: You are using npm version 5.6.0. There may be bugs in this version, use it at your own risk. We recommend version 4.6.1.
Warning: 'graphql' peer depencency missing. Run `npm ls` in /home/erik/dev/projects/mancloud/engine to see full warning.
Since I installed npm with the nvm script, I’ll try switching to version 4.6.1 as well…
I’ll keep you posted…
The problem is with npm and not expo.
I’m very aware of that, I’m just reporting my experience on how to get Expo to play nice with my already existing Graphql / Relay endpoint, hoping that others might find this usefull as well. I might still be bringing up other issues with non-expo related modules, but as far as I’m aware of, this is a forum (and not the expo bugtracker).
In the documentation I can see that I’m supposed to add an entry in .graphqlrc, describing the endpoint and optionally adding request headers. The issue I have here is that my endpoint is secured by OAuth and the token expires (currently after 2 days) so I still need to figure some way to request a new token first and inject that in the graphql request headers, without it being stored in this static .graphqlrc file.
"url": "[[GRAPHQL ENDPOINT]]",
"Authorization": "Bearer [[TOKEN]]"
This topic was automatically closed 20 days after the last reply. New replies are no longer allowed.