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

Error: RelayParser: Encountered duplicate defintitions for one or more documents #17811

Closed
rgiese opened this issue Sep 22, 2019 · 9 comments
Closed
Labels
stale? Issue that may be closed soon due to the original author not responding any more. type: bug An issue or pull request relating to a bug in Gatsby

Comments

@rgiese
Copy link
Contributor

rgiese commented Sep 22, 2019

Description

Same issue as #11688; creating new issue since the previous one was marked as fixed with an attached code change.

Any Gatsby site can fail to build with the following error provided you're building on Windows and your CWD path is using a lower-case drive name:

 ERROR #85901  GRAPHQL

There was an error in your GraphQL query:

Error: RelayParser: Encountered duplicate defintitions for one or more documents: each document must have a unique name. Duplicated documents:
- eReposGrumpyv2GatsbyStarterBlogMdxSrcTemplatesBlogPostJs1876540457
- eReposGrumpyv2GatsbyStarterBlogMdxSrcPagesIndexJs4125737639

Steps to reproduce

  • Create a root directory for a new Gatsby site (e.g. e:\repos\grumpyv2) and make sure the Windows terminal shows the current path with a lower-case drive letter (clown around with something like cd /d e:\repos from a different drive letter to make sure it really is lowercase).

  • Clone my sample repo from https://github.com/rgiese/gatsby_issue17811, or just create a new Gatsby site that has a GraphQL query in one of its pages, e.g. gatsby new gatsby-starter-blog-mdx https://github.com/hagnerd/gatsby-starter-blog-mdx (which is all my sample repo is).

  • gatsby build

Expected result

The site builds.

Actual result

image

Environment

e:\repos\grumpyv2\gatsby-starter-blog-mdx>gatsby info --clipboard

  System:
    OS: Windows 10
    CPU: (16) x64 AMD Ryzen 7 2700X Eight-Core Processor
  Binaries:
    npm: 6.9.0 - C:\Program Files\nodejs\npm.CMD
  Languages:
    Python: 2.7.16
  Browsers:
    Edge: 44.18362.329.0
  npmPackages:
    gatsby: ^2.14.4 => 2.15.20
    gatsby-image: ^2.0.22 => 2.2.20
    gatsby-plugin-feed: ^2.0.8 => 2.3.13
    gatsby-plugin-google-analytics: ^2.0.5 => 2.1.17
    gatsby-plugin-manifest: ^2.0.5 => 2.2.18
    gatsby-plugin-mdx: ^1.0.33 => 1.0.43
    gatsby-plugin-offline: ^2.0.5 => 2.2.10
    gatsby-plugin-react-helmet: ^3.0.0 => 3.1.8
    gatsby-plugin-sharp: ^2.0.6 => 2.2.25
    gatsby-plugin-typography: ^2.2.0 => 2.3.8
    gatsby-remark-copy-linked-files: ^2.0.5 => 2.1.20
    gatsby-remark-images: ^3.1.19 => 3.1.23
    gatsby-remark-responsive-iframe: ^2.0.5 => 2.2.17
    gatsby-remark-smartypants: ^2.0.5 => 2.1.9
    gatsby-source-filesystem: ^2.0.2 => 2.1.26
    gatsby-transformer-remark: ^2.1.6 => 2.6.24
    gatsby-transformer-sharp: ^2.1.3 => 2.2.16

Thoughts on fixes

We should be able to just make this go away - someone's got to be using a non-Windows-enlightened path manipulation library somewhere.

Barring that, at least raise a more useful error message. This wasted three hours of my life yesterday and it's a pretty popular issue judging from Google (even since February when we last tried to fix it).

@rgiese
Copy link
Contributor Author

rgiese commented Sep 22, 2019

Tagging @pieh since he last worked in this land (#12005)

@rgiese
Copy link
Contributor Author

rgiese commented Sep 22, 2019

Oh and if this ends up being a fix in Relay, I'm happy to help drive that.

@LekoArts LekoArts added the type: bug An issue or pull request relating to a bug in Gatsby label Sep 23, 2019
@waltercruz
Copy link
Contributor

This is windows, right?

Probably it will work if you do cd E:\ (capital letter) instead of cd e:\

@rgiese
Copy link
Contributor Author

rgiese commented Sep 26, 2019

@waltercruz Yes, it's Windows, and the steps you pointed out are the remedy that got me off the ground.

That said, it's still a bug, it's a regression from earlier this year, and, if I may, in 2019 OS-dependent path casing is not a battle I (or the non-trivial number of other users who are running into this, judging from Google results) should still have to fight, if we can avoid it.

@waltercruz
Copy link
Contributor

in 2019 OS-dependent path casing is not a battle

I wish that this was the case, but Mac OS Filesystem and Windows handling of casing doesn't make things easy, and when you have situations where your develop on a OS and deploys in another, things get even weirder.

We should be able to just make this go away - someone's got to be using a non-Windows-enlightened path manipulation library somewhere.

There is - true-case-path, and gatsby it's already using it. But even with it, things aren't that easy.

I solved a issue that prevented gatsby from running on a shared host - and even if it seems strange, it's all about casing on different OS.

I could try to fix #17811 that, but it's gonna take some time as I don't have access to any windows machine. I'm pretty sure that your test repository will work fine on Linux or mac machines (can try on both tomorrow)

BTW, windows cmd seems really weird. Check this comment on true-case-path.

@Madgeniusblink
Copy link

Hey guys,

I am having a similar issue:

ERROR #85901 GRAPHQL

There was an error in your GraphQL query:

Error: RelayParser: Encountered duplicate defintitions for one or more documents: each document must have a unique name. Duplicated documents:

  • allShopifyCollections

has anyone come up with a solution?

this happened very randomly.. I literally when to eat after taking a break.. and when I when to bring my website up "npm run develop" it started to act out.
any ideas on how to fix it?

@rgiese
Copy link
Contributor Author

rgiese commented Oct 16, 2019

@Madgeniusblink , provided you're on Windows, make sure that your current path as shown on the command line has an uppercase drive letter.

@gatsbot gatsbot bot added the stale? Issue that may be closed soon due to the original author not responding any more. label Nov 6, 2019
@gatsbot
Copy link

gatsbot bot commented Nov 6, 2019

Hiya!

This issue has gone quiet. Spooky quiet. 👻

We get a lot of issues, so we currently close issues after 30 days of inactivity. It’s been at least 20 days since the last update here.

If we missed this issue or if you want to keep it open, please reply here. You can also add the label "not stale" to keep this issue open!

As a friendly reminder: the best way to see this issue, or any other, fixed is to open a Pull Request. Check out gatsby.dev/contribute for more information about opening PRs, triaging issues, and contributing!

Thanks for being a part of the Gatsby community! 💪💜

@gatsbot
Copy link

gatsbot bot commented Nov 17, 2019

Hey again!

It’s been 30 days since anything happened on this issue, so our friendly neighborhood robot (that’s me!) is going to close it.

Please keep in mind that I’m only a robot, so if I’ve closed this issue in error, I’m HUMAN_EMOTION_SORRY. Please feel free to reopen this issue or create a new one if you need anything else.

As a friendly reminder: the best way to see this issue, or any other, fixed is to open a Pull Request. Check out gatsby.dev/contribute for more information about opening PRs, triaging issues, and contributing!

Thanks again for being part of the Gatsby community!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stale? Issue that may be closed soon due to the original author not responding any more. type: bug An issue or pull request relating to a bug in Gatsby
Projects
None yet
Development

No branches or pull requests

4 participants