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

Gastby Error: RelayParser - Duplicated documents: - DefaultSEOQuery #939

Closed
sutter opened this issue Jul 4, 2019 · 10 comments
Closed

Gastby Error: RelayParser - Duplicated documents: - DefaultSEOQuery #939

sutter opened this issue Jul 4, 2019 · 10 comments
Labels
bug Something isn't working stale v1

Comments

@sutter
Copy link

sutter commented Jul 4, 2019

Bug Report

Describe the bug
Gatsby build is broken. I followed the instructions of https://www.docz.site/docs/gatsby-theme#how-to-use

A clear and concise description of what the bug is.

When i lunch my gatsby develop.

To Reproduce

  1. Go to https://github.com/sutter/hello-gatsby/tree/feature/add-documentation'
  2. clone the repo read the readme for install dev dependecies
➜  hello-gatsby git:(feature/add-documentation) gatsby develop
Configuring yargs through package.json is deprecated and will be removed in the
success open and validate gatsby-configs - 2.034 s
success load plugins - 0.970 s
Configuring yargs through package.json is deprecated and will be removed in the
success onPreInit - 0.312 s
success initialize cache - 0.006 s
success copy gatsby files - 0.066 s
success onPreBootstrap - 0.009 s
Configuring yargs through package.json is deprecated and will be removed in the
success source and transform nodes - 0.532 s
success building schema - 0.287 s
Configuring yargs through package.json is deprecated and will be removed in the
success createPages - 0.309 s
success createPagesStatefully - 0.036 s
success onPreExtractQueries - 0.002 s
success update schema - 0.041 s

 ERROR 

There was a problem parsing "/Users/laurentsutterlity/Works/hello-gatsby/node_modules/gatsby-theme-docz/templates/Layout.tpl.js"; any GraphQL fragments or queries in this file were not processed.
This may indicate a syntax error in the code, or it may be a file type that Gatsby does not know how to parse.


 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:
- DefaultSEOQuery

success extract queries from components - 8.357 s
success write out requires - 0.008 s
success write out redirect data - 0.002 s
success Build manifest and related icons - 0.137 s
success onPostBootstrap - 0.144 s
⠀
info bootstrap finished - 17.704 s
⠀
success run static queries - 0.002 s
success run page queries - 0.026 s — 7/7 292.91 queries/second
 DONE  Compiled successfully in 6477ms                                    09:12:11
⠀
You can now view hello-gatsby in the browser.
⠀
  http://localhost:8000/
⠀
View GraphiQL, an in-browser IDE, to explore your site's data and schema

  http://localhost:8000/___graphql

Note that the development build is not optimized.
To create a production build, use npm run build

Environment

  • OS: [10.14.5]
  • Node version: [v10.15.3]
  • Yarn version: [1.15.2]
@pedronauck
Copy link
Member

This is a bug related to the new version of Gatsby, I think that they're working to fix this.
cc @pieh

@yashasolutions
Copy link

similar issue here

@Shero-Inc
Copy link

Hitting the same issue as well, Do you know if there is a previous version of Gatsby that could still work or is it a dependency mess to even consider an older version?

@marinoguerieri
Copy link

marinoguerieri commented Aug 5, 2019

I'm having similar issue after installing Docz theme.

EDIT: Actually, I'm having the exact same issue.
Are there any workarounds?

@mozzillation
Copy link

mozzillation commented Aug 9, 2019

Same here, after installing Docz Theme.

EDIT: do we have news about this issue?

@rakannimer rakannimer added the v1 label Aug 27, 2019
@Protectator
Copy link

I'm encountering this problem as well after trying to migrate to v2. And why does it have the v1 tag if it's related to Gatsby ?

@rakannimer rakannimer added bug Something isn't working v2 labels Aug 29, 2019
@weslleyaraujo
Copy link

Facing this issue on v2.0.0-rc.31 😬

@jstacoder
Copy link
Contributor

If anyone is using v2, just make sure your gatsby is up to date and you should be fine, now for anyone that is for whatever reason stuck on v1 (like me) you can solve the problem locally by altering a file from the docz gatsby theme In your node_modules the main downside with that is anytime you add or update your dependencies it will overwrite the fix, but for me just replacing the file as a part of my build has allowed me to keep it totally automated.

The main issue is the file node_modules/gatsby-theme-docs/templates/Seo.js.tpl it exports a query and because its intended to be a template to generate another file, but it’s still processed by gatsby , we end up with its query name duplicated in the schema, ie error. So to fix it, you just need to remove the name from the query, since query names are only required in graphql when using variables, so this query doesn’t need a name, so in that file just change

query DefaultSeoQuery {

Into

query {

@rakannimer
Copy link
Contributor

Thanks @jstacoder for the solution 👍 !

Make sure to check out patch-package if you use @jstacoder's solution to consistently alter your node_modules as part of your build step.

@rakannimer rakannimer removed the v2 label Sep 29, 2019
eeshdarthvader pushed a commit to eeshdarthvader/bento that referenced this issue Oct 30, 2019
There is a RelayParser error in newer version of gatsby. Restricting till fixed.

Tracking status here - doczjs/docz#939
@stale
Copy link

stale bot commented Nov 28, 2019

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale label Nov 28, 2019
@stale stale bot closed this as completed Dec 5, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working stale v1
Projects
None yet
Development

No branches or pull requests

10 participants