Prismic Toolbar doesn’t appear + Preview doesn’t work

Dear Prismic community,

I am running Prismic with GatsbyJS using gatsby-source-prismic and gatsby-plugin-prismic-previews, and my site is hosted on Gatsby Cloud

My Prismic toolbar is not appearing despite signed in to my repo. On top of that, I couldn’t preview the content change via localhost despite having Previews already set up on settings (doesn’t redirect me to the page after clicking the eye icon, it stops at ‘Loading Preview…’ page).

Below are my code which should responsible to the toolbar appearance.

preview.js

import * as React from 'react'
import { withPrismicPreviewResolver } from 'gatsby-plugin-prismic-previews'
import { linkResolver } from "../utils/linkResolver";

const PreviewPage = () => {
  return (
    <main>
      <h1>Loading preview...</h1>
    </main>
  )
}

export default withPrismicPreviewResolver(PreviewPage, [
  {
    repositoryName: 'my-repo',
    linkResolver: linkResolver,
  },
])

linkResolver.js

module.exports = {
  apiEndpoint: 'https://my-repo.cdn.prismic.io/api/v2',
  repoName: "my-repo",
  linkResolver: function(doc) {
    if (doc.type === 'page') return "/" + doc.uid
    if (doc.type === 'work') return "/work/" + doc.uid  
    return "/doc" + doc.uid
    }
}

At the end of my {prismicPage.url}.js

...
export default withPrismicPreview(PageTemplate, [
  {
    repositoryName: 'my-repo',
    linkResolver: linkResolver,
  },
])

At the end of my 404.js

...
export default withPrismicUnpublishedPreview(
  NotFoundPage,
  [
    {
      repositoryName: 'my-repo',
      linkResolver: linkResolver,
      componentResolver: componentResolverFromMap({
         page: PageTemplate,
         work: WorkTemplate,
      }),
    },
  ],
)

I couldn't see what else I'm missing here. Let me know if there's any else info that I should provide.

Thanks in advance!

Best Regards,
Fong

2 Likes

Hi there,

Welcome to the Prismic community,
Some other users are reporting an issue with the preview that might be related to this issue.

Would you mind taking a screenshot of the cookies you have when starting a preview to check if this issue impacts you:

https://community.prismic.io/t/toolbar-preview-cookie-issue/6608/8

Looking forward to your reply,
Fares

A post was merged into an existing topic: Toolbar Preview cookie issue

It appears to be the same issue and we are investigating. Please refer to that thread for further updates.

1 Like