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

schema transform bug: cannot return null for non nullable type subscription_root.user #1002

Closed
wawhal opened this issue Nov 15, 2018 · 4 comments
Labels
bug has-reproduction ❤ Has a reproduction in a codesandbox or single minimal repository v5

Comments

@wawhal
Copy link

wawhal commented Nov 15, 2018

So we are trying to perform schema-stitching with schema transforms to prefix schema types and root-fields. This is how we do it:

const renameSchema = (schema, prefix) => {
 return transformSchema(
    schema,
    [
      new RenameTypes((type) => `${prefix}_${type}`),
      new RenameRootFields((operation, name) => `${prefix}_${name}`)
    ]
  );     
};

Without renaming, the schema stitching works totally.
After renaming, it works fine in case of queries and mutations but throws an error in case of subscriptions.

The error message reads "Cannot return null for non-nullable field subscription_root.user".

Some details:

  1. Subscription root of the remote server: subscription_root
  2. New subscription root: Subscription
  3. Old root fields: user images
  4. New root fields: hasura_user, hasura_images

You can clone this repo and run npm install && npm start from the root to see this error in action.
https://github.com/wawhal/custom-resolvers-boilerplate

@ghost ghost added bug has-reproduction ❤ Has a reproduction in a codesandbox or single minimal repository labels Nov 15, 2018
@yaacovCR
Copy link
Collaborator

Duplicate of #997.
Fixed in #1104.

@yaacovCR
Copy link
Collaborator

Fixed in graphql-tools-fork https://www.npmjs.com/package/graphql-tools-fork

@kamilkisiela
Copy link
Collaborator

We recently released an alpha version of GraphQL Tools (#1308) that should fix the issue.

Please update graphql-tools to next or run:

npx match-version graphql-tools next

Let us know if it solves the problem, we're counting for your feedback! :)

@yaacovCR yaacovCR mentioned this issue Mar 27, 2020
22 tasks
@yaacovCR
Copy link
Collaborator

Rolled into #1306

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug has-reproduction ❤ Has a reproduction in a codesandbox or single minimal repository v5
Projects
None yet
Development

No branches or pull requests

3 participants