Skip to content

Resolvers after calling stitchSchemas doesn't have access to the query aliases anymore #6329

Closed Answered by Rowadz
Rowadz asked this question in Q&A
Discussion options

You must be logged in to vote

TL;DR

Pass batch: true to the main and subschemas to fix this

For anyone who stumbled upon this in the future

This only happens at the root level AND only if the passed schema config doesn't use the 🟣 batching feature 🟣, I'm not sure why exactly.

So for the below code, the schema I'm passing will be treated like a subschema and internally the proxied resolvers will send a single request for reach root level using the executor you passed at some points

For the below code

export const gatewaySchema = stitchSchemas({
  subschemas: [schema],
})

const yoga = createYoga<GraphQLContext>({
  schema: gatewaySchema,
})

with this query:

query users{
  user_with_id_01 :user(id:1){
    id

    name

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by Rowadz
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