Skip to content

@graphql-codegen/cli >= 2.13.10 causes "Unknown fragment" error #8570

Closed
@rosskevin

Description

@rosskevin

Describe the bug

$ yarn codegen
$ graphql-codegen --config ./codegen.ts
✔ Parse Configuration
⚠ Generate outputs
  ❯ Generate to types.ts
    ✔ Load GraphQL schemas
    ✔ Load GraphQL documents
    ✖ GraphQL Document Validation failed with 1 errors;
      Error 0: Unknown fragment "CurrentUser".
      at /sandbox/.graphql:9:8
error Command failed with exit code 1.

Broken sandbox:

https://codesandbox.io/s/gql-codegen-fragment-error-reversion-narrow-dep-mtze4x?file=/package.json

  "dependencies": {
    "@graphql-codegen/cli": "2.13.10", // <---------
    "@graphql-codegen/typescript": "2.8.1",
    "@graphql-codegen/typescript-operations": "2.5.6",
    "graphql": "^16.2.0"
  }

Working sandbox:

https://codesandbox.io/s/gql-codegen-fragment-error-reversion-working-9j9i6q?file=/package.json

  "dependencies": {
    "@graphql-codegen/cli": "2.13.9",
    "@graphql-codegen/typescript": "2.8.1",
    "@graphql-codegen/typescript-operations": "2.5.6",
    "graphql": "^16.2.0"
  },

Your Example Website or App

https://codesandbox.io/s/gql-codegen-fragment-error-reversion-narrow-dep-mtze4x?file=/package.json

Steps to Reproduce the Bug or Issue

yarn generate

Expected behavior

I expect @graphql-codegen/cli >= 2.13.10 to work like previous versions.

Screenshots or Videos

No response

Platform

see codesandbox

Codegen Config File

default codesandbox file

Additional context

This has been working fine and I was surprised with a fresh ncu -u && yarn install with only patch releases updated that my codegen is broken. I've narrowed the test sandbox down to @graphql-codegen/cli@2.13.9 being successful, and @graphql-codegen/cli@2.13.10 failing.

Metadata

Metadata

Assignees

Labels

coreRelated to codegen core/clistage/4-pull-requestA pull request has been opened that aims to solve the issue

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions