Prismic embed fields intermittently returning errors to GraphQL queries

I’ve started getting an GraphQL error when querying a Prismic embed field from Gatsby. It’s worked fine for the last few weeks but started erroring this morning (with no changes on my side).

After a bit of debugging it started working again for an hour or so but now I’m seeing the error again.

In Gatsby’s GraphQL editor it returns the error Cannot query field \"[field_name]\" on type \"PrismicEmbedType\ for each field nested inside the embed field.

This is the query working as expected previously:

This is the same query returning an error:

In the Prismic GraphQL editor it returns the error Field 'video' of type 'Json' must not have a sub selection so this seems to be the root error that’s causing the one in Gatsby.

This is the query that used to work, now returning an error:

It no longer lets me define the fields I want to be returned and just returns everything as below:

Apart from this being inconsistent behaviour, in the Gatsby GraphQL editor it forces me to add a nested field so it’s not possible to just query the field with no subsections.

As nothing has changed on my side it looks like it must be something to do with Prismic’s definition of the embed field changing that has caused the error.

The Prismic repo for this project is mattrawworksinclay. Thanks for your help :v:

Hi Pete, thanks for reaching out to us.

This error is unusual; we have not had other reports of broken links from Vimeo until now. I have checked the logs for your repository, and it is not throwing any errors. Also, I tested your endpoint in a test Gatsby project, and it returns the Embed field with no errors.

Can you still reproduce this error on your end?

It is important to note that Prismic's GraphQL API explorer is not the same as using Gatsby's GraphiQL tool. The gatsby-source-prismic plugin is based on Prismic's REST API instead of GraphQL. That is why the Prismic explorer does not recognize the schema you use in your Gatsby queries.

Hi Pau,

Thanks for looking into this.

I realised overnight that the data returned in the Prismic editor is correct and that this must be an issue with the Gatsby Source Prismic plugin rather than Prismic.

The error is no longer happening for me but if it does, I’ll create an issue on the plugin repo.

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.