gatsbyjs / gatsby

The best React-based framework with performance, scalability and security built in.
https://www.gatsbyjs.com
MIT License
55.27k stars 10.31k forks source link

-warn- Multiple node fields resolve to the same GraphQL field #19491

Closed MauriceOppenberger closed 4 years ago

MauriceOppenberger commented 4 years ago

might be banal but I am getting this error message when compiling and deploying by gatsby site. That site is still being built but I can't figure out what causes the error message

Message --- warn Multiple node fields resolve to the same GraphQL field wordpress__acf_pages.acf.landingbackground - [landingbackground, landingbackground___NODE]. Gatsby will use landingbackground___NODE. warn Multiple node fields resolve to the same GraphQL field wordpress__acf_pages.acf.contactbackground - [contactbackground, contactbackground___NODE]. Gatsby will use contactbackground___NODE. warn Multiple node fields resolve to the same GraphQL field wordpress__acf_pages.acf.exterioricon - [exterioricon, exterioricon___NODE]. Gatsby will use exterioricon___NODE. warn Multiple node fields resolve to the same GraphQL field wordpress__acf_pages.acf.interioricon - [interioricon, interioricon___NODE]. Gatsby will use interioricon___NODE. warn Multiple node fields resolve to the same GraphQL field wordpress__acf_pages.acf.additionalicon - [additionalicon, additionalicon___NODE]. Gatsby will use warn Multiple node fields resolve to the same GraphQL field wordpress__PAGE.acf.landingbackground - [landingbackground, landingbackground___NODE]. Gatsby will use landingbackground___NODE. warn Multiple node fields resolve to the same GraphQL field wordpress__PAGE.acf.contactbackground - [contactbackground, contactbackground___NODE]. Gatsby will use contactbackground___NODE. warn Multiple node fields resolve to the same GraphQL field wordpress__PAGE.acf.exterioricon - [exterioricon, exterioricon___NODE]. Gatsby will use exterioricon___NODE. warn Multiple node fields resolve to the same GraphQL field wordpress__PAGE.acf.interioricon - [interioricon, interioricon___NODE]. Gatsby will use interioricon___NODE. warn Multiple node fields resolve to the same GraphQL field wordpress__PAGE.acf.additionalicon - [additionalicon, additionalicon___NODE]. Gatsby will use additionalicon___NODE. warn Multiple node fields resolve to the same GraphQL field wordpress__wp_media.guid - [guid___NODE, guid]. Gatsby will use guid___NODE.

my query---

query HomePageQuery { wordpressPage(title: { eq: "Homepage" }) { acf { landingbackground { localFile { url childImageSharp { fluid(quality: 100, maxWidth: 2000) { ...GatsbyImageSharpFluid_withWebp src } } } } contactbackground { localFile { url childImageSharp { fluid(quality: 100, maxWidth: 1800) { ...GatsbyImageSharpFluid_withWebp src } } } } exterioricon { localFile { url } } interioricon { localFile { url } } additionalicon { localFile { url } } } } }

any suggestions?

Summary

Relevant information

Environment (if relevant)

File contents (if changed)

gatsby-config.js: N/A package.json: N/A gatsby-node.js: N/A gatsby-browser.js: N/A gatsby-ssr.js: N/A

LekoArts commented 4 years ago

Thank you for opening this!

These warnings can sometimes occur in certain situations with the wordpress source plugin but they shouldn't cause any troubles. So for now: Save to ignore.

If you want you can try WPGraphQL: https://www.wpgraphql.com/ It's a great way to use Gatsby with Wordpress.

We're marking this issue as answered and closing it for now but please feel free to comment here if you would like to continue this discussion. We also recommend heading over to our communities if you have questions that are not bug reports or feature requests. We hope we managed to help and thank you for using Gatsby!

havietduc91 commented 4 years ago

Hi @LekoArts,

I'm facing the same issue here with Airtable,

warn Multiple node fields resolve to the same GraphQL field `Airtable.data.Project` - [`Project`, `Project___NODE`]. Gatsby will use `Project___NODE`.
warn Multiple node fields resolve to the same GraphQL field `Airtable.data.Publication` - [`Publication`, `Publication___NODE`]. Gatsby will use `Publication___NODE`.

Could you please let me know the solution to resolve it, many thanks

szimek commented 4 years ago

I've got the same issue with Contentstack (https://www.gatsbyjs.org/packages/gatsby-source-contentstack/):

warn Multiple node fields resolve to the same GraphQL field `Contentstack_post.author` - [`author`, `author___NODE`]. Gatsby will use `author___NODE`.
warn Multiple node fields resolve to the same GraphQL field `Contentstack_post.category` - [`category`, `category___NODE`]. Gatsby will use `category___NODE`.
warn Multiple node fields resolve to the same GraphQL field `Contentstack_post.featured_image` - [`featured_image`, `featured_image___NODE`]. Gatsby will use
...
warn There are conflicting field types in your data.

Could it have any impact on createSchemaCustomization and createTypes call?

selenecodes commented 4 years ago

I have the same issue with Strapi, in specific the gatsby-source-strapi plugin.

warn Multiple node fields resolve to the same GraphQL field `StrapiCategory.articles.image` - [`image`, `image___NODE`]. Gatsby will use `image___NODE`.
warn Multiple node fields resolve to the same GraphQL field `StrapiArticle.image` - [`image`, `image___NODE`]. Gatsby will use `image___NODE`.
pjamieson commented 4 years ago

Closed because?

kulahin commented 3 years ago

The decision is obvious enough: try not to use the same field names for different types. I had such warnings in my Gatsby+Wordpress site: warn Multiple node fields resolve to the same GraphQL field wordpress__wp_event.acf.image - warn Multiple node fields resolve to the same GraphQL field wordpress__wp_city.acf.image - warn Multiple node fields resolve to the same GraphQL field wordpress__acf_event.acf.image - warn Multiple node fields resolve to the same GraphQL field wordpress__acf_city.acf.image - warn There are conflicting field types in your data. When I changed the image field name for both types to event_image and city_image the warnings had gone away. The only issue is that I don't understand why Gatsby behaves so strange...

JOEMN96 commented 3 years ago
warn Multiple node fields resolve to the same GraphQL field `StrapiCakes.slider.img` - [`img`, `img___NODE`]. Gatsby will use
`img___NODE`.
warn Multiple node fields resolve to the same GraphQL field `StrapiCakes.mainImg` - [`mainImg`, `mainImg___NODE`]. Gatsby will use  
`mainImg___NODE`.
warn Multiple node fields resolve to the same GraphQL field `StrapiBlogs.image` - [`image`, `image___NODE`]. Gatsby will use        
`image___NODE`.
warn Multiple node fields resolve to the same GraphQL field `StrapiFeaturedContents.image` - [`image`, `image___NODE`]. Gatsby will 
use `image___NODE`.
warn Multiple node fields resolve to the same GraphQL field `StrapiHeroslider.AdditionalImg.Imgs` - [`Imgs`, `Imgs___NODE`]. Gatsby 
will use `Imgs___NODE`.
warn Multiple node fields resolve to the same GraphQL field `StrapiHeroslider.slider1` - [`slider1`, `slider1___NODE`]. Gatsby will 
use `slider1___NODE`.

same warning with gatsby strapi plugin

fnebenfuehr commented 3 years ago

I've got the same warning with gatsby-source-shopify

Multiple node fields resolve to the same GraphQL field ShopifyArticle.blog - [blog, blog___NODE]. Gatsby will use blog___NODE.

jimreesman commented 3 years ago
warn Multiple node fields resolve to the same GraphQL field `StrapiCakes.slider.img` - [`img`, `img___NODE`]. Gatsby will use
`img___NODE`.
warn Multiple node fields resolve to the same GraphQL field `StrapiCakes.mainImg` - [`mainImg`, `mainImg___NODE`]. Gatsby will use  
`mainImg___NODE`.
warn Multiple node fields resolve to the same GraphQL field `StrapiBlogs.image` - [`image`, `image___NODE`]. Gatsby will use        
`image___NODE`.
warn Multiple node fields resolve to the same GraphQL field `StrapiFeaturedContents.image` - [`image`, `image___NODE`]. Gatsby will 
use `image___NODE`.
warn Multiple node fields resolve to the same GraphQL field `StrapiHeroslider.AdditionalImg.Imgs` - [`Imgs`, `Imgs___NODE`]. Gatsby 
will use `Imgs___NODE`.
warn Multiple node fields resolve to the same GraphQL field `StrapiHeroslider.slider1` - [`slider1`, `slider1___NODE`]. Gatsby will 
use `slider1___NODE`.

same warning with gatsby strapi plugin

same.

jimreesman commented 3 years ago

The decision is obvious enough: try not to use the same field names for different types. I had such warnings in my Gatsby+Wordpress site: warn Multiple node fields resolve to the same GraphQL field wordpress__wp_event.acf.image - warn Multiple node fields resolve to the same GraphQL field wordpress__wp_city.acf.image - warn Multiple node fields resolve to the same GraphQL field wordpress__acf_event.acf.image - warn Multiple node fields resolve to the same GraphQL field wordpress__acf_city.acf.image - warn There are conflicting field types in your data. When I changed the image field name for both types to event_image and city_image the warnings had gone away. The only issue is that I don't understand why Gatsby behaves so strange...

agree it's strange. it implies that the gatsby schema keeps node field names in a common namespace (hence the collision for .image when you have event.image and city.image). this creates "pressure" to artificially change the schema (if you are led to believe this is a problem for gatsby). I'd really like a definitive answer from the gatsby devs - if this is actually NOT a concern, then this warning should be removed. Otherwise, if this is a legitimate source of problems, what are the possible problems? How do we avoid them - other than going back to the schema to make it "gatsby-aware"?

marcinkoziej commented 3 years ago

Same:

warn Multiple node fields resolve to the same GraphQL field `StrapiFrontpage.features.icon` - [`icon`, `icon___NODE`]. Gatsby will use `icon___NODE`.
warn Multiple node fields resolve to the same GraphQL field `StrapiFrontpage.products.image` - [`image`, `image___NODE`]. Gatsby will use `image___NODE`.
warn Multiple node fields resolve to the same GraphQL field `StrapiFrontpage.bannerImage` - [`bannerImage`, `bannerImage___NODE`]. Gatsby will use `bannerImage___NODE`.
warn Multiple node fields resolve to the same GraphQL field `StrapiFrontpage.Video` - [`Video`, `Video___NODE`]. Gatsby will use `Video___NODE`.
warn Multiple node fields resolve to the same GraphQL field `StrapiTestimonial.avatar` - [`avatar`, `avatar___NODE`]. Gatsby will use `avatar___NODE`.

Gatsby libs used:

yarn list |grep gatsby
├─ @gatsbyjs/reach-router@1.3.6
├─ @gatsbyjs/webpack-hot-middleware@2.25.2
├─ babel-preset-gatsby@1.4.0
│  ├─ gatsby-core-utils@^2.4.0
│  └─ gatsby-legacy-polyfills@^1.4.0
├─ create-gatsby@1.4.0
├─ gatsby-awesome-pagination@0.3.8
├─ gatsby-cli@3.4.1
│  ├─ create-gatsby@^1.4.0
│  ├─ gatsby-core-utils@^2.4.0
│  ├─ gatsby-recipes@^0.15.1
│  ├─ gatsby-telemetry@^2.4.1
├─ gatsby-core-utils@2.4.0
├─ gatsby-graphiql-explorer@1.4.0
├─ gatsby-legacy-polyfills@1.4.0
├─ gatsby-link@3.4.0
├─ gatsby-node-helpers@0.3.0
├─ gatsby-page-utils@1.4.0
│  ├─ gatsby-core-utils@^2.4.0
├─ gatsby-plugin-image@1.4.1
│  ├─ gatsby-core-utils@^2.4.0
├─ gatsby-plugin-manifest@3.4.0
│  ├─ gatsby-core-utils@^2.4.0
│  ├─ gatsby-plugin-utils@^1.4.0
├─ gatsby-plugin-offline@4.4.0
│  ├─ gatsby-core-utils@^2.4.0
├─ gatsby-plugin-page-creator@3.4.1
│  ├─ gatsby-core-utils@^2.4.0
│  ├─ gatsby-page-utils@^1.4.0
│  ├─ gatsby-telemetry@^2.4.1
├─ gatsby-plugin-prefetch-google-fonts@1.4.3
├─ gatsby-plugin-react-helmet@4.4.0
├─ gatsby-plugin-sharp@3.4.2
│  ├─ gatsby-core-utils@^2.4.0
│  ├─ gatsby-telemetry@^2.4.1
├─ gatsby-plugin-styled-components@4.4.0
├─ gatsby-plugin-typescript@3.4.0
├─ gatsby-plugin-utils@1.4.0
├─ gatsby-plugin-web-font-loader@1.0.4
├─ gatsby-react-router-scroll@4.4.0
├─ gatsby-recipes@0.15.1
│  ├─ gatsby-core-utils@^2.4.0
│  ├─ gatsby-telemetry@^2.4.1
├─ gatsby-source-filesystem@3.4.0
│  ├─ gatsby-core-utils@^2.4.0
├─ gatsby-source-strapi@0.0.12
│  ├─ gatsby-node-helpers@^0.3.0
│  ├─ gatsby-source-filesystem@^1.5.39
│  ├─ gatsby-source-filesystem@1.5.39
├─ gatsby-telemetry@2.4.1
│  ├─ gatsby-core-utils@^2.4.0
├─ gatsby-transformer-json@3.4.0
├─ gatsby-transformer-sharp@3.4.0
├─ gatsby@3.4.2
│  ├─ @gatsbyjs/reach-router@^1.3.6
│  ├─ @gatsbyjs/webpack-hot-middleware@^2.25.2
│  ├─ babel-preset-gatsby@^1.4.0
│  ├─ gatsby-cli@^3.4.1
│  ├─ gatsby-core-utils@^2.4.0
│  ├─ gatsby-graphiql-explorer@^1.4.0
│  ├─ gatsby-legacy-polyfills@^1.4.0
│  ├─ gatsby-link@^3.4.0
│  ├─ gatsby-plugin-page-creator@^3.4.1
│  ├─ gatsby-plugin-typescript@^3.4.0
│  ├─ gatsby-plugin-utils@^1.4.0
│  ├─ gatsby-react-router-scroll@^4.4.0
│  ├─ gatsby-telemetry@^2.4.1
marcinkoziej commented 3 years ago

Hey, can this be re-opened?

purnimagupta commented 3 years ago

I'm also getting this error. I'm using Gatsby and Strapi and using gatsby-source-strapi plugin.

image

Any solution to this?

purnimagupta commented 3 years ago

I have the same issue with Strapi, in specific the gatsby-source-strapi plugin.

warn Multiple node fields resolve to the same GraphQL field `StrapiCategory.articles.image` - [`image`, `image___NODE`]. Gatsby will use `image___NODE`.
warn Multiple node fields resolve to the same GraphQL field `StrapiArticle.image` - [`image`, `image___NODE`]. Gatsby will use `image___NODE`.

@selenecodes, Did you find the solution to this?

avinoamsn commented 3 years ago

@LekoArts I'm aware that this is not considered an issue & has been closed accordingly. Nevertheless, I think that the people who continue to post in this thread would greatly appreciate some sort of explanation of what is going on here - even just a cursory one. Seeing as this is the top result returned on Google when you search for this warning, I think it's worth providing at least a little bit of info, or a link to some documentation that addresses this.

jdesherlia commented 2 years ago

A way to squash this would be nice as well, since it doesn't seem to cause any issues... at least not in my case. This seems like a warning about what some might think is a bad architectural design choice, but others think is a perfectly viable way to structure your content. I know in my case, I prefer to name things this way because it makes atomic development easier when I don't have to change the way I reference common models from component to component. Gatsby team, any chance we can silence this warning with a flag?

tony-gutierrez commented 1 year ago

It does cause issues in my case, results in GraphQL returning null for many of the fields, until I clear cache and rebuild. Getting worse with 5.10.0

GemN commented 1 year ago

It does cause issues in my case, results in GraphQL returning null for many of the fields, until I clear cache and rebuild. Getting worse with 5.10.0

Same. No workaround found

danielholmes commented 1 year ago

I had this problem using the strapi source. Turns out it was due to configuring a nested entity incorrectly. i.e.:

{
  singularName: 'menu-item',
  queryParams: {
    publicationState,
    populate: {
      childMenuItems: {
        populate: {
          childMenuItems: {
            populate: {
              childMenuItems: {
                populate: {
                  childMenuItems: {
                    populate: "*"
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}

Caused the issue.

Changing it to the following got rid of the warning display and null fields:

{
  singularName: 'menu-item',
  queryParams: {
    publicationState,
    populate: {
      childMenuItems: {
        populate: "*"
      }
    }
  }
}
PhilLanzetta commented 1 year ago

Also having this problem when sourcing from gatsby-source-contentful. Have tried renaming fields to no avail. If the cache is cleared, no problem but on subsequent builds:

Multiple node fields resolve to the same GraphQL field ContentfulProject.heroImage - [heroImage___NODE, heroImage]. Gatsby will use heroImage___NODE.

Results in missing images, even though this field is required in my contentful and therefore never null.

Tmcerlean commented 1 year ago

Also have this issue when sourcing from gatsby-source-contentful... Clearing cache resolves the issue. Whenever an image is uploaded to Contentful I run into the issue described above.

@tony-gutierrez @GemN @PhilLanzetta - I don't suppose any of you managed to resolve this?

PhilLanzetta commented 1 year ago

I have not. I'm running all of my projects with v5.2 as it doesn't present this problem.

Tmcerlean commented 1 year ago

Thanks for letting me know, will try out v5.2 now.

@LekoArts - can we reopen this issue please. Several people are unable to build without clearing cache due to this issue. Thanks!

Tmcerlean commented 1 year ago

@PhilLanzetta FYI I rolled back to 5.6 and all working now.

nickdraper8 commented 1 year ago

@LekoArts is there any update here? Deprecating back to a previous Gatsby version is not possible for me because of some other dependencies that require the newer versions of Gatsby.

aaronbski commented 11 months ago

This isn't always just an innocuous warning. It randomly breaks our builds in Vercel.

gabsby - 5.11.0 gatsby-source-contentful - 8.11.0

warning Multiple node fields resolve to the same GraphQL field `contentfulBlogPostSummaryTextNode.summary` - [`summary`, `summary___NODE`]. Gatsby will use `summary___NODE`.

...

error There was an error in your GraphQL query:
Field "summary" of type "contentfulBlogPostSummaryTextNode" must have a selection of subfields. Did you mean "summary { ... }"?

Retrying the build without the cache works.

jthanio commented 10 months ago

Adding on here. We have the exact same issue where any time this warning appears in the build logs on Netlify, many fields end up as null, causing missing content. Clearing cache works, but it's quite slow compared to incremental builds. I do think this issue should be re-opened, or at least rephrased and referenced in a new issue.

Edit: did #38728 fix this? Looks like there was a release yesterday for the gatsby-source-contentful plugin at least.

chawes13 commented 8 months ago

We've had this issue since we were forced to migrate from Gatsby Cloud to Netlify. Might just be a coincidence in terms of timing of releases of Gatsby and/or the contentful-source-plugin. It's quite painful – the incremental builds are already so much slower on Netlify. Having to manually clear the cache multiple times a day isn't great.

receter commented 1 week ago

I had a similar issue and was able to solve it with a schema customization:

Error:

warn Multiple node fields resolve to the same GraphQL field `STRAPI_EXAMPLE_CATEGORY.descriptionLong.data` - [`data`, `data___NODE`]. Gatsby will use
`data___NODE`.

gatsby-node.js

exports.createSchemaCustomization = ({ actions }) => {
  const { createTypes } = actions;
  createTypes(`
    type STRAPI_EXAMPLE_CATEGORY implements Node {
      descriptionLong: JSON
    }`)
}

Probably this is causes by a outdated Strapi version (v4.10.5)…