Different data between gatsby-source-prismic and graphql explorer

Hey there,

I am trying to fetch data with the gatsby-source-prismic gatsby plugin and I have difficulties creating my queries. I have a custom type named "blog_post" and I try to fetch their count by tags = "Press Release".
In the exploer on https://<my-repo>.prismic.io/graphql I can simply do

{ allBlog_posts(tags: "Press Release") { totalCount } } and it correctly returns
{ "data": { "allBlog_posts": { "totalCount": 47 } } }

However, when I use graphql in a gatsby createPages step I have to do something like
{ allPrismicBlogPost(filter: {tags: {eq: "Press Release"}}) { totalCount } }

This works, but it is the graphql wrapped by gatsby.

Is there any way I can actually write the queries the same way I write them in the graphql explorer on prismic.io and simply paste them in? That was possible on the gatsby-source-prismic-graphql plugin, which I am replacing. I don't really want to rewrite all my queries, especially since it's much easier to simulate them in the explorer and just paste them.

Hello @val_tm, thanks for reaching out.

The schema in Gatsby is different than the GraphQL schema from your repository. Gatsby has its own GraphQL playground, you can test queries there while running the project in dev mode at http://localhost:8000/___graphql

1 Like

Hey @Pau, thank you for your reply!

I know that I can see the merged schema, but this doesn't really answer my question - is there a way to directly use the Prismic queries like the old plugin with the new one (or maybe the universal GraphQL plugin), or do I definitely have to rewrite all of them to the new Gatsby schema.


Oh, I understand. Yes, you need to rewrite all of your queries for the new supported plugin. Here's a migration guide:

Please let us know if you encounter any issues while migrating.

Hey, thanks, no issues migrating, just a metric ton of queries to rewrite :slight_smile:

Marking this as solved.

1 Like