-
-
Notifications
You must be signed in to change notification settings - Fork 468
Lighthouse php GraphQL Federation Issue - "Multiple Query types" error #2697
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! 🙏
All reactions
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
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