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-strapi] content field returns null if cached copy exists (markdown via api)

See original GitHub issue

Preliminary Checks

Description

The current version of gatsby-source-strapi converts “Rich Text” fields into markdown nodes using (content field on createNode). The initial build with no cache works great. Follow up builds when the markdown content has changed, or its parent has updated the relationship returns null. I’ve run the debugger on the plugin, and it appears to be working correctly. It creates the necessary nodes needed and the relationship id’s match.

It appears to behave slightly differently if it’s a single type vs a collection. on Collection nodes the content returns null on updates on Single Type node the content just doesn’t update

Related https://github.com/strapi/gatsby-source-strapi/issues/321

Reproduction Link

n/a

Steps to Reproduce

  1. Pull data from strapi site that contains (Rich Text/Markdown) field
  2. Build site
  3. Update content in (rich text) field or parent node
  4. Rebuild

The (rich text) field will now return null.

Expected Result

I expect to be able to query

content { 
  data {
    content
  }
}

and return the updated copy

Actual Result

the outer content returns null

Environment

System:
    OS: Linux 5.10 Ubuntu 20.04.4 LTS (Focal Fossa)
    CPU: (24) x64 AMD Ryzen 9 3900X 12-Core Processor
    Shell: 5.8 - /usr/bin/zsh
  Binaries:
    Node: 14.19.3 - /usr/bin/node
    Yarn: 1.22.19 - /usr/bin/yarn
    npm: 8.12.1 - /usr/bin/npm
  Languages:
    Python: 2.7.18 - /usr/bin/python
  npmPackages:
    gatsby: ^4.15.0 => 4.16.0
    gatsby-plugin-gatsby-cloud: ^4.15.0 => 4.16.0
    gatsby-plugin-image: ^2.13.0 => 2.16.1
    gatsby-plugin-layout: ^3.15.0 => 3.16.0
    gatsby-plugin-manifest: ^4.15.0 => 4.16.0
    gatsby-plugin-postcss: ^5.14.0 => 5.16.0
    gatsby-plugin-purgecss: ^6.1.2 => 6.1.2
    gatsby-plugin-react-helmet: ^5.13.0 => 5.16.0
    gatsby-plugin-sharp: ^4.15.0 => 4.16.1
    gatsby-plugin-use-dark-mode: ^1.5.0 => 1.5.0
    gatsby-source-filesystem: ^4.15.0 => 4.16.0
    gatsby-source-strapi: ^2.0.0 => 2.0.0
    gatsby-source-strapi-plugin-navigation-v2: ^1.0.2 => 1.0.2
    gatsby-transformer-remark: ^5.13.0 => 5.16.0
    gatsby-transformer-sharp: ^4.15.0 => 4.16.0
  npmGlobalPackages:
    gatsby-cli: 4.16.0

Config Flags

No response

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:6 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
MRDRMUFNcommented, Jun 14, 2022

That might be what I’m missing. Thanks so much.

0reactions
KyleAMathewscommented, Dec 27, 2022

Sounds like they’re missing https://www.gatsbyjs.com/docs/how-to/plugins-and-themes/creating-a-transformer-plugin/#creating-the-transformer-relationship

On Mon, Jun 13, 2022, 7:13 PM MRDRMUFN @.***> wrote:

Please report this to https://github.com/strapi/gatsby-source-strapi

Has already been reported to the Strapi team as I referenced it in the ticket. I’ve run debugging and the plugin appears to be using createNode() correctly. I posted this to see if this is possibly a bug in createNode().

— Reply to this email directly, view it on GitHub https://github.com/gatsbyjs/gatsby/issues/35902#issuecomment-1154176523, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAARLB2KCZ6OYXNC7T6SSA3VO5T45ANCNFSM5YK6UYUA . You are receiving this because you are subscribed to this thread.Message ID: @.***>

Read more comments on GitHub >

github_iconTop Results From Across the Web

content.data is null when lastFetched exists #300 - GitHub
Hi,. I have a richtext type content field. Everything was good when I build it for the first time without cache.
Read more >
Build a Static Blog using Gatsby and Strapi
A static website contains Web pages with fixed content. Technically, it is a simple list of HTML files, which displays the same information ......
Read more >
gatsby-source-strapi
Source plugin for pulling documents into Gatsby from a Strapi API. ⚠️ This version of gatsby-source-strapi is only compatible with Strapi v4.
Read more >
graphql cannot query field on type query - You.com
THE_QUERY_OR_MUTATION_CODE = gql` mutation { myMutation(etc) { ; client = new ApolloClient({ cache: new InMemoryCache({ dataIdFromObject: (object) => object.key ...
Read more >
Gatsby cannot query field on type query - Caritas Castellaneta
I'm using this strapi-starter-gatsby-blog as my starting point which is inside an official Strapi repo. If you do have markdown 10 ก.
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