Outdated cypress plugin but only on 'main', even tough latest version in package.json

netlify site: https://overnext.netlify.app/
github repo: GitHub - einSelbst/overnext: explore setup options

My problem is, that netlify sometimes uses an outdated version of GitHub - cypress-io/netlify-plugin-cypress: Runs Cypress end-to-end tests after Netlify builds the site but before it is deployed.

I have a strange mismatch between preview branch builds and the main branch build.
For preview branches plugins are loaded and installed like this:

However, on the main branch I’m not able to get the latest plugin version of netlify-plugin-cypress, it always uses 1.9.2, which then results in other issues
→ Sorry, new users can only put one embedded media item in a post.

What I tried:

  • rebuilding with clean cache

  • removing cypress build cache env var from netlify.toml

  • not using netlify-nextjs-cache plugin

  • adding a npm install step before build

  • the netlify-plugin-cypress needs to be added to package.json anyway per instructions so the info in this older, almost similar issue where it was said that adding the plugin to package.json would force a specific version doesn’t seem to help in my case
    Netlify doesn't use the latest version of a plugin - #4 by devs

This is a link to a build where an outdated cypress plugin is used. The issue why it fails to deploy is something else, basically the older version of the plugin runs the tests ‘afterBuild’ instead of 'onSuccessful deployment`
https://app.netlify.com/sites/overnext/deploys/60599f1d3158b10007027d8c

Here is a preview build which is as it should be:
https://app.netlify.com/sites/overnext/deploys/6059a3e61f5c4300074bcf9e

You can also see that in preview it recognizes:
- netlify-plugin-cypress@2.1.0 from netlify.toml and package.json
while on main / production it only:
- netlify-plugin-cypress@1.9.2 from netlify.toml

It’s also very different regarding which plugins are ‘installed’ before the plugin loading.

I reallly dont understand why it works on preview deploys but not on production.

Looking forward to any idea how to upgrade netlify-plugin-cypress

The other screenshot:

hi there, are you clearing the cache and then redeploying? that should force a new download of dependencies needed for your project.

Hi Perry,

as I mentioned above:

What I tried:

  • rebuilding with clean cache

unless you talk about something else than the dropdown on the deploy log screen which has the option to “Clear cache and retry deploy”

Whenever I use this my build errors because apparently the dev dependencies are not picked up at all as it seems. I’m about to moving one dev dep after another into the production deps. Don’t ask how many build minutes I already wasted and actually, I do think it’s an issue on netlifys side. As mentioned, as long as it’s a preview build, everything just works™.

After moving all dev dependencies into (production) dependencies netlify picked them up, updated the cypress plugin and the build and deploy worked. I guess I will continue to just put all deps into production deps to avoid this problem in the future.
I’m using pnpm which means I don’t have a package.lock file, but this is usually just created so not sure if this has something to do with my issue.
After all, it’s still strange that it always worked on preview builds.