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 #85901 GRAPHQL #15344

Closed
t2ca opened this issue Jul 3, 2019 · 39 comments
Closed

ERROR #85901 GRAPHQL #15344

t2ca opened this issue Jul 3, 2019 · 39 comments
Assignees
Labels
help wanted Issue with a clear description that the community can help with. status: confirmed Issue with steps to reproduce the bug that’s been verified by at least one reviewer. type: bug An issue or pull request relating to a bug in Gatsby

Comments

@t2ca
Copy link
Contributor

t2ca commented Jul 3, 2019

Description

Updated to the latest version of gatsby 2.13.1 and started getting the following error after running gatsby develop.

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

I was able to fix this issue after removing gatsby-plugin-mailchimp

Apparently the mailchimp examples are creating a problem.

Just wanted to let everyone else know.

@javidhsueh
Copy link

Getting the same error, too. However, I don't have gatsby-plugin-mailchimp in my website

@t2ca
Copy link
Contributor Author

t2ca commented Jul 3, 2019

It could be another plugin, I searched my entire project for "SiteTitleQuery" and gatsby-plugin-mailchimp was the only result.

@m-allanson
Copy link
Contributor

I think this is related to #15284, let me see if I can put a repro together quickly.

@m-allanson m-allanson added help wanted Issue with a clear description that the community can help with. status: confirmed Issue with steps to reproduce the bug that’s been verified by at least one reviewer. type: bug An issue or pull request relating to a bug in Gatsby labels Jul 3, 2019
@m-allanson
Copy link
Contributor

m-allanson commented Jul 3, 2019

cc @sidharthachatterjee repro here: https://github.com/m-allanson/gatsby-issue-15344

steps:

  • clone repo
  • yarn
  • yarn start

This is the hello-world starter with gatsby-plugin-mailchimp added. I've seen similar with the Algolia plugin. This seems to happen with plugins that ship example code, as it's also triggering the Using the global "graphql" tag is deprecated warning.

success update schema - 0.018 s
warn Using the global `graphql` tag is deprecated, and will not be supported in v3.
Import it instead like:  import { graphql } from 'gatsby' in file:
/Users/mike/d/temp/gatsby-issue-15344/node_modules/gatsby-plugin-mailchimp/examples/gatsby-v1/src/layouts/index.js

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

success extract queries from components - 5.726 s

A quick fix might be to exclude example or examples dirs from being parsed? That might cause more problems than it solves though...

@bogdancss
Copy link
Contributor

getting this error after updating gatsby

@spookyMilly
Copy link

spookyMilly commented Jul 3, 2019

I am getting the same error when deploying my gatsby site on Netlify, none of the usual steps (npm install, deleting suspicious packages, clearing cache, ...) fixed this...

12:48:51 PM: error #85901 GRAPHQL 12:48:51 PM: There was an error in your GraphQL query: 12:48:51 PM: Unknown type "ImageSharpFixed".

@sidharthachatterjee
Copy link
Contributor

sidharthachatterjee commented Jul 3, 2019

This is occurring because some packages happen to ship example code (that includes queries). And we now parse node_modules to support queries in dependencies and themes since #15284

The correct fix for this is for packages to add examples to .npmignore

I'm fixing gatsby-plugin-mailchimp and gatsby-plugin-algolia right now and writing a script to find more plugins in the wild that need to the resolved.

In the mean time, @javidhsueh @bogdancss @spookyMilly can you please post your gatsby info results so we can find the packages that are causing this for you and fix!

Edit: Fixes for gatsby-plugin-mailchimp and gatsby-plugin-algolia are open in benjaminhoffman/gatsby-plugin-mailchimp#40 and algolia/gatsby-plugin-algolia#31

@pieh
Copy link
Contributor

pieh commented Jul 3, 2019

am getting the same error when deploying my gatsby site on Netlify, none of the usual steps (npm install, deleting suspicious packages, clearing cache, ...) fixed this...

12:48:51 PM: error #85901 GRAPHQL 12:48:51 PM: There was an error in your GraphQL query: 12:48:51 PM: Unknown type "ImageSharpFixed".

@spookyMilly This should be fixed by updating gatsby-transformer-sharp to 2.2.1

@spookyMilly
Copy link

spookyMilly commented Jul 3, 2019

Thank you so much for your help, @pieh and @sidharthachatterjee ! I updated gatsby-transformer-sharp to version 2.2.1, but got this error on deployment:

Error: Found vendored libvips v8.7.0 but require v8.7.4. Please remove the 'node_modules/sharp/vendor' directory and run 'npm install'.

Also this occured after running gatsby build:

The dependency "sharp" does not seem to have been built or installed correctly. (...) Library not loaded: @rpath/libvips-cpp.dylib (...) Reason: image not found

Here is my gatsby info, as requested by @sidharthachatterjee
System:

OS: macOS 10.14.4
CPU: (4) x64 Intel(R) Core(TM) i7-5557U CPU @ 3.10GHz
Shell: 3.2.57 - /bin/bash

Binaries:

Node: 11.10.1 - /usr/local/bin/node
Yarn: 1.16.0 - /usr/local/bin/yarn
npm: 6.9.0 - /usr/local/bin/npm

Languages:

Python: 2.7.10 - /usr/bin/python

Browsers:

Chrome: 75.0.3770.100
Firefox: 67.0.4
Safari: 12.1

npmPackages:

gatsby: ^2.4.0 => 2.4.0 
gatsby-cli: ^2.5.12 => 2.5.12 
gatsby-image: ^2.0.33 => 2.0.33 
gatsby-plugin-google-analytics: ^2.0.17 => 2.0.17 
gatsby-plugin-manifest: ^2.0.24 => 2.0.24 
gatsby-plugin-netlify: ^2.0.13 => 2.0.13 
gatsby-plugin-offline: ^2.0.25 => 2.0.25 
gatsby-plugin-react-helmet: ^3.0.9 => 3.0.9 
gatsby-plugin-sass: ^2.0.11 => 2.0.11 
gatsby-plugin-sharp: ^2.0.35 => 2.0.35 
gatsby-plugin-styled-components: ^3.0.7 => 3.0.7 
gatsby-source-filesystem: ^2.0.24 => 2.0.24 
gatsby-transformer-sharp: ^2.2.1 => 2.2.1 

Again, thank you so much. Hope this is useful for you guys.

@spookyMilly
Copy link

Hello again, sorry for the duplicate post, but I found a solution to the #85901 GRAPHQL error. Maybe this is helpful for others.

  • I updated gatsby-transformer-sharp to 2.2.1.
  • I removed sharp from the node_modules directory and re-installed it.
  • I checked my dependencies via npm list sharp, updated the packages that were listed, including gatsby-plugin-sharp and gatsby-transformer-sharp, and now gatsby build is successful and all deployments on Netlify are working as before.

Now everything is working fine again. 😆 Thanks again guys. Hope this helps you

@sidharthachatterjee
Copy link
Contributor

[email protected] is out with the fix! Thanks to @Haroenv ❤️

@darrencarlin
Copy link

I am also getting this error now, seems like its trying to 'query a query" within fragment.js in gatsby-source-contentful node_modules as if its a static query in one of my components.

If I comment out that entire file it works locally but not when deploying to netlify.

@pieh
Copy link
Contributor

pieh commented Jul 3, 2019

@darrencarlin Not ideal, but this probably happens if you have 0 assets/images - as a workaround you might try adding dummy image there (that you don't have to use)

@darrencarlin
Copy link

darrencarlin commented Jul 3, 2019

@pieh That sorted it! Thank you.

@mfosker
Copy link
Contributor

mfosker commented Jul 3, 2019

I'm also seeing this issue on Netlify, the npm modules from gatsby info are:

npmPackages:
gatsby: ^2.3.22 => 2.3.22
gatsby-plugin-google-analytics: ^2.0.18 => 2.0.18
gatsby-plugin-hotjar: ^1.0.1 => 1.0.1
gatsby-plugin-sass: ^2.0.11 => 2.0.11
gatsby-source-contentful: ^2.0.48 => 2.0.48
gatsby-source-filesystem: ^2.0.29 => 2.0.29
gatsby-transformer-remark: ^2.3.8 => 2.3.8

@mfosker
Copy link
Contributor

mfosker commented Jul 3, 2019

Probably the contentful plugin, given the error messages in the netlify deploy log:
...
error #85901 GRAPHQL
10:36:30 PM: There was an error in your GraphQL query:
10:36:30 PM: Unknown type "ContentfulFixed". Did you mean "ContentfulJob", "ContentfulJobEdge", "ContentfulContentType", "ContentfulJobFieldsEnum", or "ContentfulJobFilterInput"?
10:36:30 PM: File: node_modules/gatsby-source-contentful/src/fragments.js:4:37
...

@gemcave
Copy link

gemcave commented Jul 4, 2019

same problem, need a solution:

There was an error in your GraphQL query:
Unknown type "ContentfulFixed"

and in gatsby-transformer-sqip:
found 2 vulnerabilities (1 moderate, 1 high) in 38634 scanned packages

@kerminz
Copy link

kerminz commented Jul 4, 2019

Probably the contentful plugin, given the error messages in the netlify deploy log:
...
error #85901 GRAPHQL
10:36:30 PM: There was an error in your GraphQL query:
10:36:30 PM: Unknown type "ContentfulFixed". Did you mean "ContentfulJob", "ContentfulJobEdge", "ContentfulContentType", "ContentfulJobFieldsEnum", or "ContentfulJobFilterInput"?
10:36:30 PM: File: node_modules/gatsby-source-contentful/src/fragments.js:4:37
...

Same here!

Edit/Update:

Still not sure what the issue exactly caused, but I reinstalled gatsby-source-contentful and gatsby itself from the latest version to:

"gatsby-source-contentful": "^2.0.41", and "gatsby": "^2.9.10",

worked for me!

@marcinsydor
Copy link

marcinsydor commented Jul 4, 2019

I have the same problem after updating gatsby to 2.13.3 version.
I have two custom themes which are submodules in my main git project. One theme is using gatsby-source-datocms plugin. Any solution for this?

More info:

Main project:

System:
  OS: macOS 10.14.5
  CPU: (8) x64 Intel(R) Core(TM) i7-4770HQ CPU @ 2.20GHz
  Shell: 3.2.57 - /bin/bash
Binaries:
  Node: 10.14.2 - /usr/local/bin/node
  Yarn: 1.16.0 - /usr/local/bin/yarn
  npm: 6.4.1 - /usr/local/bin/npm
Languages:
  Python: 2.7.10 - /usr/bin/python
Browsers:
  Chrome: 75.0.3770.100
  Firefox: 66.0.3
  Safari: 12.1.1
npmPackages:
  gatsby: ^2.13.3 => 2.13.3 
  gatsby-theme-datocms: * => 0.1.0 
  gatsby-theme-ui: * => 0.0.1 
npmGlobalPackages:
  gatsby-cli: 2.4.8

and gatsby-theme-datocms theme's dependencies

    "gatsby-theme-ui": "*",
    "gatsby": "^2.13.3",
    "gatsby-image": "^2.2.4",
    "gatsby-plugin-manifest": "^2.2.1",
    "gatsby-plugin-offline": "^2.2.0",
    "gatsby-plugin-react-helmet": "^3.1.0",
    "gatsby-plugin-react-svg": "^2.1.1",
    "gatsby-plugin-robots-txt": "^1.4.0",
    "gatsby-plugin-sass": "^2.1.0",
    "gatsby-plugin-sharp": "^2.2.2",
    "gatsby-plugin-sitemap": "^2.2.1",
    "gatsby-source-filesystem": "^2.1.2",
    "gatsby-source-datocms": "^2.1.13",
    "gatsby-transformer-sharp": "2.2.1",
    "node-sass": "^4.12.0",
    "prop-types": "^15.7.2",
    "react": "^16.8.6",
    "react-dom": "^16.8.6",
    "react-css-modules": "^4.7.11",
    "react-helmet": "^5.2.1"

@mfosker
Copy link
Contributor

mfosker commented Jul 4, 2019

Thanks @kerminz
Changing to those exact versions, without the caret in the version number, worked for me:

"gatsby-source-contentful": "2.0.41", and "gatsby": "2.9.10"
rather than
"gatsby-source-contentful": "^2.0.41", and "gatsby": "^2.9.10",

I tried using the versions with the caret but that didn't help.

That will do for a temporary fix to get my site back updating until I work out a proper fix.

@marcinsydor
Copy link

I removed operations names from queries yesterday and I thought that fixed the issue but after proper testing this morning I found out that solution is not working. I'm getting more queries related errors.

I've created a minimal example to replicate ERROR #85901 GRAPHQL error. Gatsby starter + theme + site query
https://github.com/marcinsydor/gatsby-starter-default.git

@tapopov
Copy link

tapopov commented Jul 11, 2019

Started getting the same error after updating to Gatsby 2.13.0

@m-allanson
Copy link
Contributor

Thanks for the repro @marcinsydor 👍 I can confirm the issue is fixed in your repro by updating to latest gatsby and plugins. However, after the update there's a new warning message.

cc @sidharthachatterjee

success update schema - 0.021 s
warn The GraphQL query in the non-page component
Exported queries are only executed for Page components. It's possible you're
trying to create pages in your gatsby-node.js and that's failing for some
reason.

If the failing component(s) is a regular component and not intended to be a page
component, you generally want to use a <StaticQuery> (https://gatsbyjs.org/docs/static-query)
instead of exporting a page query.

If you're more experienced with GraphQL, you can also export GraphQL
fragments from components and compose the fragments in the Page component
query and pass data down into the child component — http://graphql.org/learn/queries/#fragments
success extract queries from components - 0.230 s

@marcinsydor
Copy link

Hey @m-allanson. I also tried the last Gatsby version but like you and I had got the same warnings. I did not have time to investigate in it then. But now I can say we have that message because of two index.js pages. One in the theme and one in the main project. To fix it work I need to add gatsby-plugin-page-creator plugin to the theme and rename index.js to theme-index.js. You can check it in my updated repo.

I'm not sure what Gatsby should do in that scenario. Maybe we should get warning the index.js page exists in theme and we should override it in gatsby-theme-starter/src/pages folder?

I'm also not clear why I need to add gatsby-plugin-page-creator plugin for pages in the theme. I thought all the js pages are created automatically from that folder? @sidharthachatterjee, can you give us some clarification about this?

@mrcongliu
Copy link

mrcongliu commented Jul 14, 2019

I met the same error.
The problem is because I was using Hyper terminal in windows.
Solution is using the default terminal in windows.

@spences10
Copy link
Contributor

spences10 commented Jul 16, 2019

I'm having this issue on [email protected]+ also, same as @andrewlsimplisafe I went back to [email protected] and all ok, for now.

T.Hanks

System:
OS: Linux 5.0 Ubuntu 19.04 (Disco Dingo)
CPU: (4) x64 Intel(R) Core(TM) i7-7500U CPU @ 2.70GHz
Shell: 5.0.3 - /bin/bash
Binaries:
Node: 10.10.0 - /tmp/yarn--1563253924944-0.6676510842109993/node
Yarn: 1.16.0 - /tmp/yarn--1563253924944-0.6676510842109993/yarn
npm: 6.4.1 - ~/n/bin/npm
Languages:
Python: 2.7.16 - /usr/bin/python
Browsers:
Firefox: 68.0
npmPackages:
gatsby: 2.12.0 => 2.12.0
gatsby-plugin-catch-links: ^2.0.9 => 2.1.2
gatsby-plugin-favicon: ^3.1.6 => 3.1.6
gatsby-plugin-google-analytics: 2.1.4 => 2.1.4
gatsby-plugin-manifest: 2.2.3 => 2.2.3
gatsby-plugin-netlify: ^2.0.6 => 2.1.3
gatsby-plugin-netlify-cms: 4.1.6 => 4.1.6
gatsby-plugin-offline: 2.2.4 => 2.2.4
gatsby-plugin-react-helmet: 3.1.2 => 3.1.2
gatsby-plugin-remove-serviceworker: ^1.0.0 => 1.0.0
gatsby-plugin-robots-txt: 1.5.0 => 1.5.0
gatsby-plugin-sharp: 2.2.7 => 2.2.7
gatsby-plugin-sitemap: 2.2.3 => 2.2.3
gatsby-plugin-styled-components: 3.1.2 => 3.1.2
gatsby-remark-autolink-headers: 2.1.3 => 2.1.3
gatsby-remark-external-links: 0.0.4 => 0.0.4
gatsby-remark-smartypants: ^2.0.9 => 2.1.2
gatsby-source-filesystem: 2.1.5 => 2.1.5
gatsby-source-graphql: 2.1.2 => 2.1.2
gatsby-transformer-remark: 2.6.6 => 2.6.6
gatsby-transformer-sharp: 2.2.3 => 2.2.3

@spences10
Copy link
Contributor

I fixed my issue, for me it was a configuration issue 🤦‍♂️

I didn't have gatsby-plugin-sharp & gatsby-transformer-sharp added to my transformer-remark plugins array.

@angelod1as
Copy link

I had the same problem and solved by deleting the files that resulted in errors and recreating them with different names. Apparently git was pushing both the uppercase and lowercase files (Eg: Opening and opening), resulting in the aforementioned error.

@askkai
Copy link

askkai commented Aug 2, 2019

@darrencarlin Not ideal, but this probably happens if you have 0 assets/images - as a workaround you might try adding dummy image there (that you don't have to use)

After uploading the image, a new error has appeared.

ERROR #85907 GRAPHQL
There was an error in your GraphQL query:

  • Unknown field 'file' on type 'Query'.
    File: src/components/image.js

@abhinav-anshul
Copy link

It happens when you use contentful as your CMS, as it forcefully creates image asset in the node modules folder. one needs to add a dummy image to the Media section in the contentful web application, further, if there are image manipulation plugins like gatsby-transformer-remark, gatsby-plugin-sharp or similar, you need to take care of that, as gatsby throws an exception by default in the most newer versions !!

@sidharthachatterjee
Copy link
Contributor

Looks like this is safe to close since the original issue was resolved (as I commented above) and the rest look like unrelated (but similar looking) issues that folks have figured out fixes for.

Let's close this! Thank you everyone 🙌

mattzipan added a commit to mattzipan/gatsby-plugin-mailchimp that referenced this issue Sep 8, 2019
- added import for graphql as due to build error when updating to newest gatsby:
"warn Using the global `graphql` tag is deprecated, and will not be supported in v3.
Import it instead like:  import { graphql } from 'gatsby' in file:
/Users/.../gatsby-issue-15344/node_modules/gatsby-plugin-mailchimp/examples/gatsby-v1/src/layouts/index.js"


- across many modules there are examples that keep the same query names which throws a graphql error for not using unique query names.
See for example: gatsbyjs/gatsby#15344.
Therefore changed query name to something more unique.
@patrickreynolds
Copy link

@pieh Amazing.

If anyone was wondering what they meant by "adding dummy image there", follow these steps:

  1. Login to Contenify
  2. On the top navigation, select Media
  3. Upload any asset (I uploaded a 100px by 100px white square)
  4. Try rebuilding, and it just works

I have so many questions, but already wasted enough time on this to try to understand why that matters.

@djangman
Copy link

djangman commented Oct 23, 2019

@pieh Amazing.

If anyone was wondering what they meant by "adding dummy image there", follow these steps:

  1. Login to Contenify
  2. On the top navigation, select Media
  3. Upload any asset (I uploaded a 100px by 100px white square)
  4. Try rebuilding, and it just works

I have so many questions, but already wasted enough time on this to try to understand why that matters.

Thanks for this answer. I'm currently trying to do this, but when I attempt any image upload, getting "An error occurred while uploading your asset.", no matter what image I upload.
Hopefully contentful will resolve that very soon. ( might be a corporate firewall though, too,.. so I'm going to try connecting to their guest wifi here ).
Edit: dang, that was it. ( shouldn't be working on their time anyway )

@sdennett55
Copy link

sdennett55 commented Dec 5, 2019

Spent an embarassing amount of time with this issue, when all it took to resolve was:

npm install [email protected]

i ran npm outdated to see that gatsby-plugin-mailchimp was red and needed to be updated.

@piscespieces
Copy link

piscespieces commented Dec 10, 2019

It happens when you use contentful as your CMS, as it forcefully creates image asset in the node modules folder. one needs to add a dummy image to the Media section in the contentful web application, further, if there are image manipulation plugins like gatsby-transformer-remark, gatsby-plugin-sharp or similar, you need to take care of that, as gatsby throws an exception by default in the most newer versions !!

This worked just great for me. Thanks! @abhinav-anshul

@amolmt
Copy link
Contributor

amolmt commented Dec 21, 2019

@darrencarlin Not ideal, but this probably happens if you have 0 assets/images - as a workaround you might try adding dummy image there (that you don't have to use)

Adding a dummy image in contentful web app worked for me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Issue with a clear description that the community can help with. status: confirmed Issue with steps to reproduce the bug that’s been verified by at least one reviewer. type: bug An issue or pull request relating to a bug in Gatsby
Projects
None yet
Development

No branches or pull requests