Preview broken with GraphQL - unknown type

I am using Gatsby and the gatsby-source-prismic-graphql plugin to preview content and build a frontend for content in Prismic. For certain content types, I am also using gatsby-source-graphql and a local schema to query another graphql endpoint with it’s own type (call it MyType).

The prismic data and other graphql endpoint data need to be shown on the same page, so I have a page query which references both of them. Once I click on the preview button for this content type, the page renders okay visually, but does not show the previewed content. Looking at the network tab on Chrome DevTools, the Prismic graphql endpoint returns a 500 HTTP status code and the following message: {“message”:"Query does not pass validation. Violations:\n\nUnknown type ‘MyType’. (line 1, column 838) … ) }

How can I provide my local schema to Prismic in order that the GraphQL endpoint understands the types which are not related to Prismic?

1 Like


We’ve tested this on our side and concluded that:

Using another plugin to query a different endpoint along with the gatsby-source-prismic-graphql plugin makes a conflict in the schema. You can define both plugins in the configuration but the first one will always take the place of the other one, making the second one inaccessible.

Another thing is that queries that do not come from the gatsby-source-prismic-graphql plugin cannot be added into the dynamic queries made in the /templates files. These kinds of queries require to be done in the traditional way of querying pages in Gatsby. Or in a separate StaticQuery component.

Probably all of these made your current query not pass the validation like stated in the error.

If we can help you with anything else, let us know