0

I have a website made with Gatsby 4. The content is coming from Prismic CMS. I have uploaded the code on GitHub and deployed on Netlify and everything was working.

Then, I noticed my .env files (.env.development and .env.production) where being tracked by git. So I added the .env* to the gitignore file and ran the following command:

git rm -r --cached .env.production
git rm -r --cached .env.development

Now the build on Netlify fails as it tells me the following error:

12:12:24 PM: error Invalid plugin options for "gatsby-source-prismic":
12:12:24 PM: - "repositoryName" is required
12:12:24 PM: - "value" must contain at least one of [customTypesApiToken, customTypeModels, schemas]
12:12:24 PM: not finished load plugins - 0.240s

My gatsby.config file is the following:

require("dotenv").config({
  path: `.env.${process.env.NODE_ENV}`,
})

{
      resolve: "gatsby-source-prismic",
      options: {
        repositoryName: process.env.GATSBY_PRISMIC_REPO_NAME,
        accessToken: process.env.PRISMIC_ACCESS_TOKEN,
        customTypesApiToken: process.env.PRISMIC_CUSTOM_TYPES_API_TOKEN,
      },
    },

So I am actually providing a repositoryName and customTypesApiToken.

Could someone help me understand what I am doing wrong?

Ferran Buireu
  • 28,630
  • 6
  • 39
  • 67
Alice
  • 49
  • 6

0 Answers0