babel-plugin-react-relay icon indicating copy to clipboard operation
babel-plugin-react-relay copied to clipboard

Error thrown with certain endpoint

Open Magneticmagnum opened this issue 8 years ago • 2 comments
trafficstars

I'm not sure where else to ask for help, but I believe I've narrowed it down to the graphql server or this repo.

I started my project based off the https://learnrelay.org tutorial, and changed the URL to use my own graphql server with authentication. (The git repo is https://github.com/learnrelay/pokedex/tree/master/branch-step-02-solution) I'd simply like to swap off the current graphql endpoint and implement my own.

This is how my project is currently setup:

package.json

"graphql": { "request": { "url": "http://myGraphQLEndpoint/graphql/query", "headers": { "Content-Type": "application/json", "apiToken": "fasdfasefasef" } } },

index.js

Relay.injectNetworkLayer( new Relay.DefaultNetworkLayer('http://myGraphQLEndpoint/graphql/query', { headers: { "Content-Type": "application/json", apiToken: 'fasdfasefasef' } }) );

I get the following error:

Module build failed: TypeError: Cannot read property 'errors' of null
    at exports.default (c:\dev\pokedex\node_modules\babel-plugin-react-relay\lib\index.js:30:13)
    at Function.memoisePluginContainer (c:\dev\pokedex\node_modules\babel-core\lib\transformation\fi
le\options\option-manager.js:109:13)
    at Function.normalisePlugin (c:\dev\pokedex\node_modules\babel-core\lib\transformation\file\opti
ons\option-manager.js:142:32)
    at c:\dev\pokedex\node_modules\babel-core\lib\transformation\file\options\option-manager.js:180:
30
    at Array.map (native)
    at Function.normalisePlugins (c:\dev\pokedex\node_modules\babel-core\lib\transformation\file\opt
ions\option-manager.js:154:20)
    at OptionManager.mergeOptions (c:\dev\pokedex\node_modules\babel-core\lib\transformation\file\op
tions\option-manager.js:229:36)
    at OptionManager.init (c:\dev\pokedex\node_modules\babel-core\lib\transformation\file\options\op
tion-manager.js:374:12)
    at File.initOptions (c:\dev\pokedex\node_modules\babel-core\lib\transformation\file\index.js:216
:65)
    at new File (c:\dev\pokedex\node_modules\babel-core\lib\transformation\file\index.js:139:24)
    at Pipeline.transform (c:\dev\pokedex\node_modules\babel-core\lib\transformation\pipeline.js:46:
16)
    at transpile (c:\dev\pokedex\node_modules\babel-loader\index.js:14:22)
    at Object.module.exports (c:\dev\pokedex\node_modules\babel-loader\index.js:88:12)
 @ multi main

Would anybody know why this error might be occuring? As a note, this doesn't error out when connecting to the learnrelay.org graphql endpoint. I don't believe there is an issue with my graphql endpoint, as I am able to send queries to it with POSTMAN with authentication headers successfully.

Any tips would be greatly appreciated!

Magneticmagnum avatar Dec 05 '16 18:12 Magneticmagnum

Hey @Magneticmagnum. You could try to do the following in order to debug your situation:

  1. Clone https://github.com/graphcool/graphql-config locally and run npm link
  2. Clone https://github.com/graphcool/babel-plugin-react-relay locally and run npm link graphql-config-parser and npm link
  3. Run npm link babel-plugin-react-relay in your local application which uses babel-plugin-react-relay
  4. Try to debug graphql-config and babel-plugin-react-relay by changing its code and running npm build in both repositories.

It's possible that it's a bug here: https://github.com/graphcool/graphql-config Would be great if you could already look into it and pin down the problem.

schickling avatar Dec 06 '16 10:12 schickling

Thanks for the debugging tips! I'll look into it!

Magneticmagnum avatar Dec 06 '16 11:12 Magneticmagnum