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

Defer directive can only be used on fragments #1135

Closed
jasonkuhrt opened this issue Sep 26, 2024 · 0 comments · Fixed by #1138
Closed

Defer directive can only be used on fragments #1135

jasonkuhrt opened this issue Sep 26, 2024 · 0 comments · Fixed by #1138
Labels
Milestone

Comments

@jasonkuhrt
Copy link
Member

Get this error currently when using the defer directive:

ContextualAggregateError: One or more errors in the execution result.
    at handleOutput (/Users/jasonkuhrt/projects/jasonkuhrt/graffle/src/layers/6_client/handleOutput.ts:53:19)
    at run (/Users/jasonkuhrt/projects/jasonkuhrt/graffle/src/layers/6_client/client.ts:236:12)
    at process.processTicksAndRejections (node:internal/process/task_queues:105:5)
    at async executeDocument (/Users/jasonkuhrt/projects/jasonkuhrt/graffle/src/layers/6_client/client.ts:157:12)
    at async <anonymous> (/Users/jasonkuhrt/projects/jasonkuhrt/graffle/examples/55_generated/directive.ts:10:18) {
  context: {},
  cause: undefined,
  errors: [
    GraphQLError: Directive "@defer" may not be used on FIELD.
        at <anonymous> (/Users/jasonkuhrt/projects/jasonkuhrt/graffle/src/lib/graphqlHTTP.ts:32:47)
        at Array.map (<anonymous>)
        at parseExecutionResult (/Users/jasonkuhrt/projects/jasonkuhrt/graffle/src/lib/graphqlHTTP.ts:31:28)
        at Object.unpack (/Users/jasonkuhrt/projects/jasonkuhrt/graffle/src/layers/5_core/core.ts:195:26)
        at process.processTicksAndRejections (node:internal/process/task_queues:105:5)
        at async runHook (/Users/jasonkuhrt/projects/jasonkuhrt/graffle/src/lib/anyware/runHook.ts:279:16) {
      path: undefined,
      locations: undefined,
      extensions: [Object: null prototype] {}
    }
  ]
}

Issue is that we allow it on fields, but actually that's not how it's used. See https://the-guild.dev/graphql/yoga-server/docs/features/defer-stream#using-defer

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant