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

graphql-import does not work with Apollo Federation #352

Closed
villesau opened this issue Aug 1, 2019 · 3 comments
Closed

graphql-import does not work with Apollo Federation #352

villesau opened this issue Aug 1, 2019 · 3 comments

Comments

@villesau
Copy link

villesau commented Aug 1, 2019

HI, when building federated schema using basic builiding blocks, following error is thrown:

error: Uncaught exception: (message=Directive key: Couldn't find type key in any of the schemas., stack=Error: Directive key: Couldn't find type key in any of the schemas.
    at collectDirective (/Users/user/code/node_modules/graphql-import/src/definition.ts:172:15)
    at Array.forEach (<anonymous>)
    at collectNewTypeDefinitions (/Users/user/code/node_modules/graphql-import/src/definition.ts:86:30)
    at Object.completeDefinitionPool (/Users/user/code/node_modules/graphql-import/src/definition.ts:49:39)
    at Object.importSchema (/Users/user/code/node_modules/graphql-import/src/index.ts:127:18)

The type that causes the issue looks like this:

type SomeType @key(fields: "id") {
  id: ID!
}

key directive is something that glues different pieces of extended types together when federating schema. See the documentation for further details: https://www.apollographql.com/docs/apollo-server/federation/core-concepts/

Could the validation be loosened on import-schema library so that key would not cause exception?

@ardatan
Copy link
Owner

ardatan commented Dec 31, 2019

Hi @villesau !
In 1.0.0 beta release, we introduced a lot of changes including apollo federation support;
Could you install graphql-import@beta to try new changes? Don't forget to modify your code regarding to the migration notes in README.
https://github.com/ardatan/graphql-import#updating-from-07x

@villesau
Copy link
Author

Thanks @ardatan ! Unfortunately we postponed our federation plans so I'm not able to test it any time soon. I hope someone else who has faced this issue can report back if the changes works for them!

@ardatan
Copy link
Owner

ardatan commented Mar 17, 2020

Available in 1.0.0!

@ardatan ardatan closed this as completed Mar 17, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants