Netlify-plugin-gatsby-cache deleting random blog pages on every deploy

Hi, @proton. When I tried to build the site locally I get this error:

$ GATSBY_EXPERIMENTAL_PAGE_BUILD_ON_DATA_CHANGES=true gatsby build --log-pages
╔════════════════════════════════════════════════════════════════════════╗
║                                                                        ║
║   Gatsby collects anonymous usage analytics                            ║
║   to help improve Gatsby for all users.                                ║
║                                                                        ║
║   If you'd like to opt-out, you can use `gatsby telemetry --disable`   ║
║   To learn more, checkout https://gatsby.dev/telemetry                 ║
║                                                                        ║
╚════════════════════════════════════════════════════════════════════════╝
success open and validate gatsby-configs, load plugins - 1.243s
info [@imgix/gatsby] Loaded plugin.
success onPreInit - 0.049s
success initialize cache - 0.024s
success copy gatsby files - 0.070s
success Compiling Gatsby Functions - 0.351s
success onPreBootstrap - 0.381s
success gatsby-source-prismic - create types - 0.021s

 ERROR

[@imgix/gatsby] Fatal error during setup: Error: The plugin config is not in the correct format. Errors: Invalid value undefined supplied to :
GatsbySourceUrlOptions/domain: string

not finished createSchemaCustomization - 0.082s

error Command failed with exit code 1.

I also notices that you are using a number of environment variables for the build at Netlify. Do weed need to enable those environment variable locally and at Netlify to test this? If so, do we have your permission to reused the environment variables for affectionate-curie-46aff8 when we test?

If not, how do you recommend we test this site build? What is required to get it to build successfully?

Hi @luke, yes feel free to access to variables. Thanks

I’ve also removed GATSBY_EXPERIMENTAL_PAGE_BUILD_ON_DATA_CHANGES=true just in case it might be the cause of the issue, but it wasn’t.

Hi @proton , thank you for creating and sharing the new repo with us! We really appreciate it :pray: While Luke works on building the site locally I wanted to check on a few things.

Firstly, in our audit logs, I see you uninstalled netlify-plugin-gatsby-cache and installed @netlify/plugin-gatsby on Aug 6. I looked thru your deploy logs since that time and had trouble finding a build log that had netlify-plugin-gatsby-cache installed. Can you share the deploy ID where you see both plugins installed?

Secondly, good hunch for removing the Gatsby incremental build feature! Can you please also try changing the build command to env && <your usual build command>? This will confirm the removal in the build log for us.

Let us know how it goes!

Hi @audrey,

I don’t think there’s any evidence of both plugins being installed simultaneously in Netlify’s build environment after I switched them . However, it does happen when building locally using Netlify CLI.

For the reproduction repo that I made, only the one plugin is loading - which is correct - when building using Netlify CLI.

Apologies, I’m somewhat of a novice when it comes to constructing build scripts. Do you mean in the Netlify UI that you want the build command to be something like yarn env && build?

Thanks

Hey @proton , thanks for clarifying!

For the build command, when you execute the build locally can you try using the command env && netlify build That will generate output in the build log and tell us if the Gatsby incremental build feature was indeed removed.

I forked your repo and I’m working on building locally to test as well!

Hey @audrey, here is the output I get when running that script:

SECURITYSESSIONID=186aa
USER=kevin
__CFBundleIdentifier=com.microsoft.VSCode
COMMAND_MODE=unix2003
LOGNAME=kevin
PATH=/usr/local/lib/ruby/gems/3.0.0/bin:/usr/local/opt/ruby/bin:/Users/kevin/google-cloud-sdk/bin:/Users/kevin/.nvm/versions/node/v15.14.0/bin:/Users/kevin/.nvm/versions/node/v14.15.3/bin:/Users/kevin/.composer/vendor/bin:/usr/local/opt/mysql@5.7/bin:/usr/local/sbin:/opt/yarn-1.22.4/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/Apple/usr/bin:/usr/local/lib/ruby/gems/3.0.0/bin:/usr/local/opt/ruby/bin:/Users/kevin/google-cloud-sdk/bin:/Users/kevin/.nvm/versions/node/v14.15.3/bin:/Users/kevin/.composer/vendor/bin:/usr/local/opt/mysql@5.7/bin:/usr/local/sbin:/opt/yarn-1.22.4/bin
SSH_AUTH_SOCK=/private/tmp/com.apple.launchd.5anzTsynKt/Listeners
SHELL=/bin/zsh
HOME=/Users/kevin
__CF_USER_TEXT_ENCODING=0x1F5:0x0:0x0
LaunchInstanceID=F308AA35-2666-455E-AEC0-6FDF2FF4389D
TMPDIR=/var/folders/ww/n_5swn1j7js2r0qtlhq5bqwh0000gn/T/
XPC_SERVICE_NAME=0
XPC_FLAGS=0x0
ORIGINAL_XDG_CURRENT_DESKTOP=undefined
SHLVL=1
PWD=/Users/kevin/Sites/bpp
OLDPWD=/Users/kevin/Sites/bpp
ZSH=/Users/kevin/.oh-my-zsh
PAGER=less
LESS=-R
LSCOLORS=Gxfxcxdxbxegedabagacad
NVM_DIR=/Users/kevin/.nvm
NVM_CD_FLAGS=-q
NVM_BIN=/Users/kevin/.nvm/versions/node/v15.14.0/bin
NVM_INC=/Users/kevin/.nvm/versions/node/v15.14.0/include/node
TERM_PROGRAM=vscode
TERM_PROGRAM_VERSION=1.59.1
LANG=en_US.UTF-8
COLORTERM=truecolor
VSCODE_GIT_IPC_HANDLE=/var/folders/ww/n_5swn1j7js2r0qtlhq5bqwh0000gn/T/vscode-git-f32d09e202.sock
GIT_ASKPASS=/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/git/dist/askpass.sh
VSCODE_GIT_ASKPASS_NODE=/Applications/Visual Studio Code.app/Contents/Frameworks/Code Helper (Renderer).app/Contents/MacOS/Code Helper (Renderer)
VSCODE_GIT_ASKPASS_MAIN=/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/git/dist/askpass-main.js
not finished Caching JavaScript and CSS webpack compilation - 31.432s
not finished Caching HTML renderer compilation - 12.832s


────────────────────────────────────────────────────────────────
  Netlify Build                                                 
────────────────────────────────────────────────────────────────

❯ Version
  @netlify/build 12.17.0

❯ Flags
  dry: false
  offline: false

❯ Current directory
  /Users/kevin/Sites/bpp

❯ Config file
  /Users/kevin/Sites/bpp/netlify.toml

❯ Context
  production

❯ Loading plugins
   - netlify-plugin-gatsby-cache@0.3.0 from Netlify app
   - @netlify/plugin-gatsby@1.0.3 from netlify.toml and package.json

Hi @audrey, any luck?

Hey there! Thanks for the repro.

It’s tricky because this is using Prismic, to be honest. And, I think that that is where the issue lies, personally. It’s the only thing we don’t have visibility over and nothing else which I can see appears to be awry.

I’ve checked the repro’s deploy and the pages specified are deleted (e.g. /blog/easily-understand-how-to-stop-procrastinating doesn’t exist). But, this is what the build is being told by Prismic?

If this was reproducible without Prismic, then I’d be inclined to say that this is a failing of the build system. Otherwise, I think this may need input from the gatsby-source-prismic maintainer(s).

Thanks for the clarification @Scott . That makes sense and I’ve move this issue over to Prismic support. Hope we can figure it out over there!