-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
[relay-compiler] After upgrade to 1.5.0, it throws ERROR: Type "Address" already exists in the schema. It cannot also be defined in this type definition. #2346
Comments
is there only one type Address? |
@sibelius Yes, there is only one type Address in the schema.graphql file. |
could u create a repo to reproduce this? |
@sibelius I'm seeing the same issue. It's not clear what needs to be done to reproduce it, given that the error message is incorrectly stating that the defintion already exists. When I run the compiler with
Upon inspecting the source code, I see that line // TODO T24511737 figure out if this is dangerous |
Can you add logging statements to the line where it invokes |
Otherwise, in order to make a repro, an empty app with your schema should probably suffice, if you can share that. |
I am seeing the same issue with a different type definition, also only have one defined. |
@nightspirit Because you have wrong args so compiler scans dirs with the schema files. I had the same problem. Check https://github.com/este/este/blob/b60c7a2f8f7c2b78ba4d0a889fee8a78cb2bbd50/package.json#L12 You have to process only dirs without the other schemas. cc @jsteiner Compiler could have a better error message for that. |
@steida After I move the schema.graphql out of src directory as well as changing the command. It seems working.
1.4.1 accept the schema.graphql in the src folder. I guess the error is somehow related to "client-only schema extensions" feature. Does it scan the src folder for .graphql files and add additional type to schema definition? The main schema should be excluded from scanning in my opinion. |
@nightspirit I think this is correct! See #2264. Thanks! And sorry for the trouble! |
@jstejada I think we should fix this DX by excluding the |
I´m sorry, but it´s not clear to me what should be done. I´m facing the same problem:
And my command:
My graph ql is generated at tha following folder: d:\dev\app\client\src\data Should I change the directory, change parameters or something else ? Please clarify... |
@renatonmendes Check https://github.com/este/este for an inspiration. |
@steida, hummm... Should I put my |
@renatonmendes Yes, the problem is when your schema file resides inside the source root you specify with |
Going to re-open this and make a fix to improve DX. |
Maybe I missed something too, but I am having the same issue. I set my project up exactly how @steida has his setup. Put my
Still getting the error, here is a snapshot of my |
@ErnestGrey Your server schema exists inside |
@alloy My apologies, but I don't follow, I don't have a |
I wasn’t clear enough and have updated my comment. I meant the source root that you designate with the |
Getting the same error, now in my monorepo:
Isn´t that a bug, as my |
That seems suspicious indeed. If you grep |
Case closed and problem solved. There was an old To finish I would like to leave 3 suggestions: a) Really bypass the current file that is being processed. Why parse the file that we know cannot be parsed? b) Print, on verbose, what files are being processed. That way we will know on each file and path we have a problem. Remember that some projects has tons of folders and files (like mine) c) Change this error message with something like: There may be a graphql file being processed in the src folder. |
Is the correct work around, for now, not to have the schema file in the src directory specified for the relay-compiler? |
@mvachhar Yes. |
|
node_modules/.bin/relay-compiler --src ./src/ --schema ./schema.graphql Error: Cannot find module 'graphql' |
In our schema.graphql, we define a type Address for common address
It works when we are using 1.4.1 without issues. But today when we upgrade to 1.5.0 (along with relay-runtime/react-relay) we no longer able to compile the static queries.
react-compiler keeps throwing ERROR:
Type "Address" already exists in the schema. It cannot also be defined in this type definition.
After we downgrade to 1.4.1, the compiler works again.
The text was updated successfully, but these errors were encountered: