Can not set up Gatsby Prismic preview

Hi, Prismic People. Could you please help me with setting up Gatsby Prismic preview? I made everything by tutorial in documentation, but preview shows just that it is fetching. And I can not close "Preview is fetching" window.

I use Gatsby 4. My preview.js file:

import * as React from 'react';
import { withPrismicPreviewResolver } from 'gatsby-plugin-prismic-previews';

const PreviewPage = () => {
  return <h1>Loading preview…</h1>;

export default withPrismicPreviewResolver(PreviewPage);

My linkResolver:

const { defaultLanguage } = require('./../../prismic-config');

const linkResolver = (doc) => {
  const properties = doc._meta || doc;

  if (properties.type === 'homepage') {
    return properties.lang === defaultLanguage
      ? '/'
      : `/${properties.lang.slice(0, 2)}/`;

  if (properties.type === 'blog') {
    return properties.lang === defaultLanguage
      ? '/blog'
      : `/${properties.lang.slice(0, 2)}/blog`;

  if (properties.type === 'preview') {
    return properties.lang === defaultLanguage
      ? '/preview'
      : `/${properties.lang.slice(0, 2)}/preview`;

  if (properties.type === 'blogpost' && properties.uid) {
    return properties.lang === defaultLanguage
      ? `/blog/${properties.uid}`
      : `/${properties.lang.slice(0, 2)}/blog/${properties.uid}`;

  // Backup for all other types
  return '/';

module.exports = linkResolver;

Hello @dmitry.d, thanks for reaching out.

We'll need a bit more details about your setup to scan if there's something missing. Have you followed this guide and checked if all the files are correct?

Hello, @Pau Thank you. Yes, I followed this guide, all files are correct.

Are you getting any other warnings in the console that could indicate a more descriptive error?

Yes, I have warnings about SameSite cookies and preview preloading (see attached file)
cc to @Prismic-Support-Team

Hi Mitya,

So the 'SameSite cookies' warning should be ok, but I would guess the issue here is maybe with the 'preview preloading' warning, although I'm not a Gatsby expert so I'm going to ask the team for help on this one.

In the meantime, please check out this thread for possible firefox issues:


Hello, our team is having almost the same issue, only our my case the preview is displayed after some time. We don't have this issue in dev environment, only in productions. While waiting for preview to fetch I get a browser warning, that this takes too long and if I want to cancel, but if I wait, then it loads.
We did a network recording, and something is producing a heavy load...

I went through the guides couple of times to double check if the config is correct, but as the preview work, it must be right, I guess. Is there any way I can debug this and maybe provide you with more info what is going on?
We use Gatsby v4.5.5, gatsby-source-prismic v5.2.5 and gatsby-plugin-prismic-previews v5.2.5

Hey @giedrius.bielskis1, I don't think this is related to the SameSite cookies warning. Sometimes it is affected by internet speed. Are you still having this issue?

We have the same issue in different machines and different places (home and office), and we have very good internet speed :slight_smile: the issue started after we upgraded our project from Gatsby v2 to Gatsby v4 (with all required dependencies)

You are right, it is not related to cookie, what I meant was that we have issues with long fetch of preview data. In our case the preview works, but it takes up to 1min for modal to close. During that time page is unresponsive as some heavy calculations are done (as you can see from the graph that I added earlier).

I've just talked to the team and we noticed this is happening to a few other people as well.
We'll need to investigate further and figure out what is happening.
We'll let you know if we find something.

Here's the open conversation on GitHub about this. Please refer to this thread if you want to get updates about this issue: