TypeError: Cannot read property 'pathname' of undefined withPreview gatsby-source-prismic

I have been using gatsby-source-prismic and with the withPreview I get an error as follows

Hi Dennis,

Welcome to Prismic community,

The Gatsby plugin that we support currently is the gatsby-source-prismic-graphql and here is link to our documentations that uses this plugin.

In order to be able to debug this issue, can you tell me if you have added a LinkResolver file and used it? if so then can you share a code snippet of the link usage you are trying to display, you GraphQL query and the linkResolver file?

Looking forward to your reply,


You should sync better with the staff :slight_smile:

Yes we have discussed about that internally and thanks for letting us know :+1:

In fact switching plugins is already a hot topic and it seems the
gatsby-source-prismic is implemented in a way that works well with Gatsby cloud.

But nothing has been decided and we are still supporting the gatsby-source-prismic-graphql plugin until we communicate about that, along with adding some new documentations.

Can you provide a working example for the gatsby-source-prismic-graphql ? I have tried it as well, but it doesn’t fetch previews, especially on private access.

Hi Dennis,

Preview don’t currently work for this kit when repositories are set to private, we discuss that here:

You can check out our Gatsby blog sample which has everything configured correctly: