@graphql-codegen/cli >= 2.13.10 causes "Unknown fragment" error
See original GitHub issueDescribe 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.
Issue Analytics
- State:
- Created a year ago
- Reactions:20
- Comments:6
Top Results From Across the Web
[GraphQL error]: Message: Unknown fragment - Stack Overflow
Stack Overflow for Teams – Start collaborating and sharing organizational knowledge.
Read more >Unleash the power of Fragments with GraphQL Codegen
The following example would raise a TypeScript error, as the avatarUrl field is not selected within the UserListItem_UserFragment fragment.
Read more >gatsby | Yarn - Package Manager
Gatsby automates code splitting, image optimization, inlining critical styles, lazy-loading, prefetching resources, and more to ensure your site is fast — no ...
Read more >TypeScript with GraphQL done right - Charly Poly
Stronger generated TypeScript types; Getting the most of your GraphQL Code Generator configuration; Tips: Leverage GraphQL Fragment for ...
Read more >Compare Packages Between Distributions - DistroWatch.com
antfs-cli-unstable-2017-02-11 anthy-9100h antibody-6.1.1 ... assertion-error-20191227-git ... busybox-static-x86_64-unknown-linux-musl-1.35.0 butane-0.16.0
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Hi everyone!
Very sorry for this regression introduced in a great performance improvement of codegen validations (now 40x faster) 🏎️
It is now fixed in
@graphql-codegen/cli@2.13.12
📦Just hit this as well – good to know I’m not crazy 😅