Suddenly Strapi content is not showing in GraphQL query

Everything was working well, I had created a content type of Job and could query this with allStrapiJobs but today I edited one of the Jobs content and suddenly I was getting an error saying it couldn’t find allStrapiJobs. I checked in GraphiQL and allStrapiJobs has indeed disappeared. I’ve made no changes to configuration, I’ve double checked permissions and it has “find” and “find one” both ticked. I’ve tried restarting Gatsby and Strapi local dev servers but this hasn’t helped.

Can anyone help me please?

Can you try to rebuild ?

I’ve tried running the command ‘gatsby develop’ again but it still doesn’t appear. I’m still at the beginning of development work so I’ve not used ‘gatsby build’ yet. I’m assuming I shouldn’t run ‘gatsby build’ yet, am I correct or will this command help with the issue?

allStrapiJobs was a custom query created by you in ./api/*/config/schema.graphql.js?

No, allStrapiJobs appeared in the Explorer panel of localhost:8000/___graphql after I had created the content type of Job in the Strapi admin and connected Gatsby with Strapi by adding the following in gatsby-config.js:
{
resolve: gatsby-source-strapi,
options: {
apiURL: http://localhost:1337,
queryLimit: 1000,
contentTypes: [jobs, projects, blogs],
singleTypes: [about],
},
},

EDIT: It was missing data for one content type which caused the error

1 Like

In package.json > dependencies > looking for “gatsby-source-strapi”: “^0.0.12”, if it not there or it 0.0.0 version , add manualy this “gatsby-source-strapi”: “^0.0.12” and npm i in your cmd

even im getting the same error, my collection types are not visible in the graphql playground and im not able to query it!

Seeing similar issues over here. Tried both the 0.0.12 and @alpha build as suggested on the gatsby-source-strapi readme.

Currently the fronted fails building with this error:

Encountered an error trying to infer a GraphQL type for: localFile___NODE. There is no corresponding node with the id field matching: "0eeaaf7e-ead4-5290-abe8-b00b6e26c339"

I don’t have the word localFile anywhere in my repo and it only appears in the following node_modules: gatsby-source-strapi & import-local

Running gatsby clean doesn’t seem to help either. I’m running gatsby build --no-uglify when this happens…

I manually removed node_modules/import-local and the error remains, so the culprit is most definitely the gatsby-source-strapi plugin. I’ll investigate some more and open an issue on their repo if none exists already.

Ok, so apparently the @alpha version is only going to work well with Gatsby v3 (not released yet), so going back to 0.0.12

The reason I tried the alpha version is that I have flickering GraphQL errors when using version 0.0.12: one time it fails, telling me there’s no url field on any image relation I have. To continue, I have to adjust all graphql statements to use publicURL instead. However, the next build will fail, claiming that there’s no publicURL field on any image relation I have, and I have to change all graphql statements back to using url.

I’m pretty sure this is related to how Gatsby uses both server side rendering and client side rendering and there’s somehting going wrong in between. I am however no expert whatsoever in this domain…

I had the same issue. I deleted my project and restarted following this tutorial: Build a static blog using Strapi and Gatsby 4 and it worked.

Make sure you dont have any content in draft mode, in my case i was getting the same behaviour but i had unpublished content.

I know this is late, but I’ve found mine to work after I changed my contentTypes to singular and wrapped each of them in backticks.

So, I think it should be contentTypes: [job, project, blog]
Hope this works for someone else.