question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[gatsby-source-contentful] Cannot query field "references" on type

See original GitHub issue

Description

After updating to the latest gatsby-source-contentful@4.3.0 from the canary version we are getting this error.

Cannot query field "references" on type "contentfulBlogPostBodyRichTextNode".

If you don't expect "references" to exist on the type "contentfulBlogPostBodyRichTextNode" it is most likely a typo.
However, if you expect "references" to exist there are a couple of solutions to common problems:

We’ve been using the new rich text for awhile now and this was bit of a surprise.

@jordan314 Also encountered this issue from this thread

Expected result

What should happen?

Gatsby should recognize references from rich text fields

Actual result

It doesn’t understand what they are.

Environment

System: OS: macOS High Sierra 10.13.6 CPU: (8) x64 Intel® Core™ i7-6700HQ CPU @ 2.60GHz Shell: 3.2.57 - /bin/bash Binaries: Node: 14.10.1 - /usr/local/bin/node Yarn: 1.16.0 - ~/.yarn/bin/yarn npm: 6.14.8 - /usr/local/bin/npm Languages: Python: 2.7.16 - /usr/bin/python Browsers: Chrome: 87.0.4280.88 Firefox: 83.0 Safari: 13.1.2 npmPackages: gatsby: ^2.24.50 => 2.29.1 gatsby-image: ^2.4.16 => 2.8.0 gatsby-plugin-amplitude-analytics: ^3.2.0 => 3.2.0 gatsby-plugin-mailchimp: ^5.2.2 => 5.2.2 gatsby-plugin-manifest: ^2.4.28 => 2.9.0 gatsby-plugin-next-seo: ^1.6.1 => 1.6.1 gatsby-plugin-offline: ^3.2.24 => 3.7.0 gatsby-plugin-react-helmet: ^3.3.10 => 3.7.0 gatsby-plugin-react-svg: ^3.0.0 => 3.0.0 gatsby-plugin-remove-serviceworker: ^1.0.0 => 1.0.0 gatsby-plugin-sharp: ^2.6.28 => 2.11.1 gatsby-plugin-sitemap: ^2.4.12 => 2.9.0 gatsby-plugin-theme-ui: ^0.3.0 => 0.3.5 gatsby-plugin-web-font-loader: ^1.0.4 => 1.0.4 gatsby-source-contentful: ^4.3.0 gatsby-source-filesystem: ^2.3.25 => 2.8.0 gatsby-transformer-remark: ^2.12.0 => 2.13.0 gatsby-transformer-sharp: ^2.5.13 => 2.9.0 npmGlobalPackages: gatsby-cli: 2.12.91

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:9 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
daydream05commented, Jan 29, 2021

For folks that are running into this issue:

You need to:

  1. Create “dummy” content in your rich tex field hyperlinks. Basically if you use rich text on any of your content model and you plan to hyperlink another content model, you need to create samples this for EVERY reference you’re trying to query.
1reaction
alana314commented, Dec 21, 2020

Yes we’ve found this issue too. We also had to create sample content for each rich text field. Limiting the types of content you can include in the contentful validation helps how many queries you have to write. We’re also looking into seeing if we can manually add nodes with these types of links into the codebase so that we don’t have to have these sample items in the CMS.

Read more comments on GitHub >

github_iconTop Results From Across the Web

clue/gatsby-source-contentful
Source plugin for pulling content types, entries, and assets into Gatsby from Contentful spaces. It creates links between entry types and asset so...
Read more >
Gatsby Source Contentful 4.x - Rich Text - changes to JSON
You can find an example of how to use raw in the documentation for gatsby-source-contentful. This is how a query could look like...
Read more >
Using Rich Text with the Contentful Source plugin
How to render and apply Rich Text fields with Gatsby and Contentful | Guide to querying Rich Text content with GraphQL.
Read more >
explicitly type your graphql schema if you want to use optional ...
Therefore Gatsby can't infer the type and add it to the GraphQL schema. A quick fix is to add a least one entry...
Read more >
Using Contentful and Gatsby Together - Learn With Jason
These settings cannot be changed later. Yeah, it's just one reference. Okay. In case you have a lesson with many authors, you can ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found