-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Incorrect "Not all operations have an unique name" on 1.11.2 #3326
Comments
Same here. Version
With
And I named queries like the file names. Got to stay with Version It should be somehow related to imports of fragments |
Could you try the following? schema: ...
documents:
- your-documents-pointer:
skipGraphQLImport: true |
@ardatan I just found it in other issue. Tried it out, and for 1.11.2 it didn't help here is my config: overwrite: true
schema: "http://localhost/graphql"
documents:
- "./graphql/**/*.gql":
skipGraphQLImport: true
generates:
graphql/GQLTypes.ts:
plugins:
- typescript
- typescript-operations
config:
scalars:
ObfId: number
Json: "{ [key: string]: any }" |
@ardatan Assuming I've got the YAML sigils in the correct places, this doesn't seem to have made any difference: |
I get a similar issue with updating from
It appears to break on the fragments which are defined in a separate file. This is my config
Edit: It builds if I delete the line that imports |
Could you all try with the following version? |
Just tried it - generated files are now correct. But I got other problem in my package...
Dunno how this is related to this project, but with |
@benjie I see but as I asked in here; |
|
It seems like latest version works, right? ( |
@lorado it seems like an issue with nuxt/core-js, not sure it's related to the codegen... |
Can confirm |
@dotansimha Well yes, I understand, that my problem is somewhere in combination of nuxt and graphql-codegen. But the fact is, with Just for the info: I dived a little bit deeper to find the error, and I found it. After comparison of Nuxt uses babel, and therefore install So I currently have to stay with 1.9.1 and wait till nuxt goes to core-js 3, I guess. Gonna write an issue there also. I think this issue may be closed. |
Ok, I found the solution. Nuxt needs v2, and it is possible to force usage of v2 or v3: https://nuxtjs.org/guide/release-notes#v2.6.0 (core-js part) |
I can confirm that |
I was experiencing this error and in conjunction to "Not all operations have a unique name", I experience a failure to generate a fragment That is, sometimes the error would occur, sometimes not, and when it didn't it looks like a fragment would failure to show up in my generated files. However reverting my local installation to 1.9.1 resolved both of these issues. |
@mmacheerpuppy Could you please try the given canary version above? |
@ardatan Will do! |
@ardatan Yep seems to have repaired the side effect on my end. |
@ardatan Although it seems to have removed all the GraphQL comments from my generated source file, worth noting in case that raises any red-flags on your end, I'm not sure if this is intended behavior or if I'm missing a config-diff somewhere down the line. This is also present between |
@mmacheerpuppy I guess it's related to: #3249 |
@dotansimha That's fine, thanks for all your hard work! |
Fixed in |
@dotansimha v1.12.2 - generates everything with duplicated typings e.g. for react. |
@KillerCodeMonkey You should probably raise that as a separate issue 👍 |
how did you fix this in react? My packages are:
|
@benjie how did you manage to get such a detailed error message in your console? I only get:
I can't figure out why it wont generate my DeleteGroup mutation and why it thinks the above two are have been made more than once. |
🤷 |
@MincePie can you try running codegen with env var |
hi @saihaj I get: DEBUG=true graphql-codegen DEBUG=1 graphql-codegen which is the same as I get without the debug |
and what version are you running @MincePie ? |
if it is on the latest version of codegen I would recommend you create a new issue |
Describe the bug
1.11.2 is incorrectly stating "Not all operations have an unique name" when I attempt to run codegen; 1.8.3 was working fine.
To Reproduce
Codegen works fine on the Graphile Starter
codegen-fine
branch: https://github.com/graphile/starter/tree/codegen-fineHowever, when we upgrade graphql-codegen from 1.8.3 to 1.11.2 we get the aforementioned error; see: https://github.com/graphile/starter/tree/codegen-bad which is one commit ahead of
codegen-fine
.I've dug into this further; see "Additional context"
Running
graphql-codegen
results in:Expected behavior
Codegen should run as expected (since all my operations are uniquely named)
Environment:
Ubuntu 18.04.3 LTS
v12.13.1
Additional context
I investigated further using the Node debugger because this issue is bizarre. I ended up here:
Note that the
rawSDL
value for this entry has an import andmutation DeleteEmail
; however thedefinitions
entry contains an operation and a fragment, the operation is namedAddEmail
which is not sourced from this file. The imported fragment can be seen here but doesn't contain any operations:Interestingly this fragment IS used by the
AddEmail
operation, so it looks like the re-used fragment is causing the file/operations to be interpretted incorrectly.The text was updated successfully, but these errors were encountered: