Graphql-tools: Issue with getFields in [email protected]

Created on 17 Dec 2017  ·  11Comments  ·  Source: ardatan/graphql-tools

I haven't had the chance to actually figure out what's changed, but since [email protected] was released some tests have started failing with:

    TypeError: Cannot read property 'getFields' of null
      at node_modules/graphql-tools/dist/stitching/mergeSchemas.js:109:31

          at Array.forEach (<anonymous>)

      at mergeSchemas (node_modules/graphql-tools/dist/stitching/mergeSchemas.js:88:19)

All 11 comments

Hmm, any ideas what changed? Would love to update this package to fix it asap, any help appreciated.

Working on upgrade here #541

I'm not sure what's going on, but today I'm working on a quickstart and [email protected] appears to be working properly. Must have been patched on their end. I'll do a few more tests, then close this if I can no longer reproduce.

I think it should be fine now! please re-open if it's still an issue :]

This is still happening for me using [email protected] and [email protected]:

@jlengstorf: ~/dev/gramps-graphql/gramps  (chore/upgrade-dependencies)
$ yarn test
yarn run v1.3.2
$ npm run lint --silent && npm run test:unit --silent
 FAIL  test/gramps.test.js
  ● GrAMPS › gramps() › warns for use of schema

    TypeError: Cannot read property 'getFields' of null

      143 |         typeof source.context === 'function'
      144 |           ? source.context(req)
    > 145 |           : source.context;
      146 |
      147 |       return {
      148 |         ...allContext,

      at node_modules/graphql-tools/src/stitching/mergeSchemas.ts:114:27
          at Array.forEach (<anonymous>)
      at mergeSchemas (node_modules/graphql-tools/src/stitching/mergeSchemas.ts:85:17)
      at gramps (src/gramps.js:145:1430)
      at Object.it (test/gramps.test.js:40:25)

  ● GrAMPS › gramps() › properly combines contexts

    TypeError: Cannot read property 'getFields' of null

      143 |         typeof source.context === 'function'
      144 |           ? source.context(req)
    > 145 |           : source.context;
      146 |
      147 |       return {
      148 |         ...allContext,

      at node_modules/graphql-tools/src/stitching/mergeSchemas.ts:114:27
          at Array.forEach (<anonymous>)
      at mergeSchemas (node_modules/graphql-tools/src/stitching/mergeSchemas.ts:85:17)
      at gramps (src/gramps.js:145:1430)
      at Object.it (test/gramps.test.js:64:46)

I'm going to dig into what's happening before this is called to see if maybe this is actually breaking upstream. If it _is_ happening upstream, maybe this is an opportunity to improve the error message?

I'm still pretty lost on whether this is coming from GrAMPS or graphql-tools. The error is really cryptic and flags against code that — as far as I can tell — has nothing to do with the merging portion of the process. 😕

Here's the Travis build for adding [email protected] in case it offers you any insight: https://travis-ci.org/gramps-graphql/gramps/builds/317553189

I will try to get to the bottom of this today!

@stubailo I did a little more digging, and I've isolated the problem to somewhere in our schema stitching process. Still not really sure how or why it's breaking, but I have a reproducible test case at least. 😅 https://github.com/gramps-graphql/gramps/issues/50

@stubailo Did the new mergeSchemas API somehow land in the graphql-tools upgrade you released to be compatible with graphql 0.12?

Here's a minimal reproduction https://stackblitz.com/edit/graphql-tools-issue-537

  1. Open console (notice schema logged)
  2. Open dependencies and upgrade to [email protected]
  3. Notice error is thrown
Was this page helpful?
0 / 5 - 0 ratings

Related issues

Adherentman picture Adherentman  ·  4Comments

BassT picture BassT  ·  3Comments

confuser picture confuser  ·  4Comments

adamkl picture adamkl  ·  3Comments

stubailo picture stubailo  ·  3Comments