Skip to content

Navigation Menu

Sign in
Sign up

Lighthouse php GraphQL Federation Issue - "Multiple Query types" error #2697

Answered by LuukOriginal
LuukOriginal asked this question in Q&A
Discussion options

Hello, I am getting this error when running php artisan lighthouse:print-schema --federation:

Schema must contain unique named types but contains multiple types named "Query" in @schema.graphql
Setup:

  • Laravel + Lighthouse with federated schema
  • Only ONE type Query definition exists (verified with grep)
  • Multiple result types have query: Query fields in mutation returns (according to their best practises)
  • Key insight: My working test schema doesn't have query: Query fields, but this one does:
type UpsertUserRoleResult {
 user: User,
 query: Query # <-- These might be the issue
}

Questions:

  • Could query: Query field references be confusing the federation schema builder into thinking there are multiple Query type definitions?
  • Any way to get more detailed debug info about where the "duplicate" is detected?

The federation build seems to interpret field references to Query type as duplicate type definitions. Feel free to ask if more context is needed. Any insights are appreciated! 🙏

You must be logged in to vote

Update
I managed to replicate it in the working project by just adding the type to the users object (not even using it) and it causes the error, I feel like this might be a bug, so I will have a look at the sourcecode and see if I can find something, if so I'll open an issue

Replies: 1 comment

Comment options

Update
I managed to replicate it in the working project by just adding the type to the users object (not even using it) and it causes the error, I feel like this might be a bug, so I will have a look at the sourcecode and see if I can find something, if so I'll open an issue

You must be logged in to vote
0 replies
Answer selected by LuukOriginal
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant

AltStyle によって変換されたページ (->オリジナル) /