Getting previews working in Gatsby 2

Hello, we've got a super old Gatsby v2 site, where we want to add the preview functionality via gatsby-plugin-prismic-previews. We are following this guide: Gatsby Tutorial. 6. Previews and Deployment - Prismic
Here are the relevant dependencies:

  • "gatsby-plugin-prismic-previews": "^5.2.1",
  • "gatsby-source-prismic": "^3.2.1",
  • "gatsby": "^2.13.71",

We added the following config to gatsby-config.js:

plugins: [
     .....
    {
      resolve: "gatsby-plugin-prismic-previews",
      options: {
        repositoryName: `${process.env.repositoryName}`,
        accessToken: `${process.env.API_KEY}`,
        path: "/preview",
      },
    },
    {
      resolve: "gatsby-source-prismic",
      options: {
        repositoryName: ${process.env.repositoryName}`,
        accessToken: `${process.env.API_KEY}`,
        schemas: {
          .... schemas that we copied from the custom types in prismic
        },
      },
    },
    ............

When trying to build the app, we get the following error message:

gatsby-plugin-prismic-previews(XXXXX) - Type paths for this repository could not be found. Check that you have gatsby-source-prismic configured with the same repository name and type prefix (if used) in gatsby-config.js.

Any idea, how we can fix this? Is it event possible to get preview running with such an ancient system without updating to Gatsby v3?

Thanks.

Cheers

Hello @martin.maurer, thanks for reaching out.

The document you found is part of a 6. step tutorial series. These are the documents that'll help you add the previews plugin. I recommend you go in this order so that the migration process is smooth.

First, upgrade your source plugin from V3 to V4:

Then, upgrade again, but this time from V4 to V5:

Afterwards, you'll be able to integrate the previews plugin. Here's the document that explains how to install it:

1 Like

Hey @martin.maurer

We close the threads after a week with no new activity. If this happens and you want to continue the conversation, you can easily flag it to reopen it and add a new comment.

Thanks.

Threads close after a period of inactivity. Flag this thread to re-open it and continue the conversation.