Skip to content

Cypress Github Action and Vite config import all of a sudden failing in CI/CD runs #31369

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
reintroducing opened this issue Mar 24, 2025 · 15 comments

Comments

@reintroducing
Copy link

Current behavior

Four days ago we had complete support when using the Cypress GH action and everything was working as expected. Then, the next day, a run that changed nothing in relation to any of the aforementioned files, started failing (and every subsequent run after that):
Image

When digging into the error, this is what we're seeing:
Image

Test run fine and as expected when run locally, only in GHA do they fail in this manner.

Desired behavior

This is the last run that was successful and the logging that was produced in the same spot:
Image

Test code to reproduce

Unfortunately as this is in a CI/CD run, I don't have a repro.

Cypress Version

14.2.0

Node version

22.13.0

Operating System

ubuntu-latest

Debug Logs

Run cypress-io/github-action@v6
  with:
    component: true
    install: false
    record: false
    publish-summary: true
Skipping install because install parameter is false
It looks like this is your first time using Cypress: 13.17.0

[STARTED] Task without title.
[SUCCESS] Task without title.

Opening Cypress...

DevTools listening on ws://127.0.0.1:39921/devtools/browser/edb7e2c6-1894-491c-99f3-04b73b473104
(node:2408) ExperimentalWarning: `--experimental-loader` may be removed in the future; instead use `register()`:
--import 'data:text/javascript,import { register } from "node:module"; import { pathToFileURL } from "node:url"; register("file%3A///home/runner/.cache/Cypress/13.17.0/Cypress/resources/app/node_modules/ts-node/esm/transpile-only.mjs", pathToFileURL("./"));'
(Use `node --trace-warnings ...` to show where the warning was created)
Your configFile is invalid: /home/runner/work/vr-web-ui/vr-web-ui/cypress.config.ts

It threw an error when required, check the stack trace below:

Error [ERR_MODULE_NOT_FOUND]: Cannot find module '/home/runner/work/vr-web-ui/vr-web-ui/vite.config' imported from /home/runner/work/vr-web-ui/vr-web-ui/cypress.config.ts
    at finalizeResolution (node:internal/modules/esm/resolve:283:11)
    at moduleResolve (node:internal/modules/esm/resolve:952:10)
    at defaultResolve (node:internal/modules/esm/resolve:1188:11)
    at ModuleLoader.defaultResolve (node:internal/modules/esm/loader:642:12)
    at #cachedDefaultResolve (node:internal/modules/esm/loader:591:25)
    at ModuleLoader.getModuleJobForRequire (node:internal/modules/esm/loader:347:53)
    at new ModuleJobSync (node:internal/modules/esm/module_job:333:34)
    at ModuleLoader.importSyncForRequire (node:internal/modules/esm/loader:320:11)
    at loadESMFromCJS (node:internal/modules/cjs/loader:1371:24)
    at Module._compile (node:internal/modules/cjs/loader:1511:5)
    at Module._extensions..js (node:internal/modules/cjs/loader:1613:10)
    at Module.load (node:internal/modules/cjs/loader:1275:32)
    at Module._load (node:internal/modules/cjs/loader:1096:12)
    at Module.require (node:internal/modules/cjs/loader:1298:19)
    at require (node:internal/modules/helpers:182:18)
    at loadFile (/home/runner/.cache/Cypress/13.17.0/Cypress/resources/app/node_modules/@packages/server/lib/plugins/child/run_require_async_child.js:89:14)
Test run failed, code 1
More information might be available above
Cypress module has returned the following error message:
Could not find Cypress test run results
Error: Could not find Cypress test run results

Other

This is the code for the quality gate job:

name: Quality Gate

on: push

jobs:
  quality:
    runs-on: ubuntu-latest
    steps:
      - name: Check out the repository
        uses: actions/checkout@v4
      - name: Set up node
        uses: actions/setup-node@v4
        with:
          node-version-file: .nvmrc
      - name: Install npm dependencies
        run: npm ci
      - name: Run linters
        uses: rkuykendall/lint-action@master
        with:
          continue_on_error: false
          eslint: true
          eslint_extensions: 'js,jsx,ts,tsx'
          prettier: true
          # We can't use this yet as we have too many issues to fix
          # tsc: true
          # tsc_extensions: 'ts,tsx'
      - name: Run component tests
        uses: cypress-io/github-action@v6
        with:
          component: true
          install: false
@jennifer-shehane
Copy link
Member

@reintroducing Did your Node.js version change or anything else in the repo? Unless something from the GitHub Action is impacting it, I'd suspect there's a change in the env or repo that changed. The GitHub Action changes don't look like they'd impact this behavior.

@jennifer-shehane jennifer-shehane added the stage: needs information Not enough info to reproduce the issue label Mar 24, 2025
@jennifer-shehane
Copy link
Member

jennifer-shehane commented Mar 24, 2025

I'd suspect Node.js was updated to 20.19.0 or another higher version where Node.js included a breaking change in a minor version that we've addressed handling and will be fixed in our next version (hopefully tomorrow) #31308

@reintroducing
Copy link
Author

@jennifer-shehane no node changes were made. as you can see in the GHA, the version of node being pulled is defined in our .nvmrc file and that is hard locked to 22.13.0 and hasn't been updated for a few months now.

@MikeMcC399
Copy link
Contributor

MikeMcC399 commented Mar 24, 2025

@reintroducing

Could you please open up your logs and check "Current runner version". If you are seeing 2.323.0 then you have been bumped to using Node.js 20.19.0. The screen shot below shows a repo which has not yet been updated.

Image

You can find a workaround in the above issue where other users have successfully applied environment variables

        env:
          NODE_OPTIONS: "--no-experimental-require-module --no-experimental-detect-module"

@reintroducing
Copy link
Author

@MikeMcC399 ah, yep, that is exactly the issue then, i'm seeing '2.323.0'. Thank you! I will await the fix then as I would rather not make changes that are not long term necessary. our tests failing in CI/CD are not mission critical at the moment as we release every two weeks and I know they work fine locally, so I'll hold off until the next release of Cypress fixes this. Appreciate the quick response on this from the both of you.

@Sporradik
Copy link

Sporradik commented Mar 26, 2025

We ran into this as well and we're still using Cypress 12. Is there any way for us to work around this if we can't update to the newest Cypress version?

@MikeMcC399
Copy link
Contributor

@Sporradik

We ran into this as well and we're still using Cypress 12. Is there any way for us to work around this if we can't update to the newest Cypress version?

Have you tried the workaround using NODE_OPTIONS mentioned above in #31369 (comment)? Note that requires a minimum of Node.js 20 in the workflow.

@WtfJoke
Copy link

WtfJoke commented Mar 26, 2025

@jennifer-shehane @MikeMcC399 do you know if a release today will happen?

Currently our pipelines are blocked and if we dont need to implement the workaround and instead just update cypress, that would be great for us.

Thank you for your efforts :)

@MikeMcC399

This comment has been minimized.

@DenisHdz
Copy link

DenisHdz commented Mar 26, 2025

@MikeMcC399 If we use the actions/setup-node@v4 action to setup the version of Node that we want, as @reintroducing is doing from the snippet he shared above, why the Cypress cypress-io/github-action@v6 is not picking up this one but the one from the runner instead?

Also, how can we tell which Node version the runner uses? The setup job only logs this:

Current runner version: '2.323.0'
Operating System
  Ubuntu
  [2](https://github.com/x/x/actions/runs/14077865329/job/39424081437#step:1:2)4.04.2
  LTS
Runner Image
  Image: ubuntu-24.04
  Version: 20250[3](https://github.com/x/x/actions/runs/14077865329/job/39424081437#step:1:3)16.1.0
  Included Software: https://github.com/actions/runner-images/blob/ubuntu2[4](https://github.com/x/x/actions/runs/14077865329/job/39424081437#step:1:4)/20250316.1/images/ubuntu/Ubuntu2404-Readme.md
  Image Release: https://github.com/actions/runner-images/releases/tag/ubuntu24%2F202[5](https://github.com/x/x/actions/runs/14077865329/job/39424081437#step:1:5)0316.1
Runner Image Provisioner
  2.0.422.1

@MikeMcC399
Copy link
Contributor

MikeMcC399 commented Mar 26, 2025

@DenisHdz

@MikeMcC399 If we use the actions/setup-node@v4 action to setup the version of Node that we want, as @reintroducing is doing from the snippet he shared above, why the Cypress cypress-io/github-action@v6 is not picking up this one but instead, the one from the runner?

This is the way that all JavaScript GitHub Actions work and it is explained briefly in https://github.com/cypress-io/github-action/blob/master/README.md#usage

The only valid value for runs.using is currently node20 and this forces the use of the Node.js version specified in

https://github.com/actions/runner/blob/d8b82f44a9ec0258904d5869ae683c31d5aac299/src/Misc/externals.sh#L9

NODE20_VERSION="20.19.0"

There is no choice about this version and it is not affected by actions/setup-node

Also, how can we tell which Node version the runner uses? The setup job only logs this:

Current runner version: '2.323.0'

In the case of a Cypress test which does not fail to load the Cypress config file, the Node.js version is shown in the Cypress test summary

  ┌────────────────────────────────────────────────────────────────────────────────────────────────┐
  │ Cypress:        14.2.0                                                                         │
  │ Browser:        Electron 130 (headless)                                                        │
  │ Node Version:   v20.19.0 (/home/runner/runners/2.323.0/externals/node20/bin/node)              │
  │ Specs:          1 found (spec.cy.js)                                                           │
  │ Searched:       cypress/e2e/**/*.cy.{js,jsx,ts,tsx}                                            │
  └────────────────────────────────────────────────────────────────────────────────────────────────┘

I could not find anywhere in the logs (not even if debug is enabled) where the JavaScript Action version of Node.js is shown if the test fails to start because of a config file issue.

@MikeMcC399
Copy link
Contributor

@reintroducing

I was able to test my repro successfully with Cypress 14.2.1 which was just released.

Please let us know if updating to this version resolves your issue.

@reintroducing
Copy link
Author

@reintroducing

I was able to test my repro successfully with Cypress 14.2.1 which was just released.

Please let us know if updating to this version resolves your issue.

@MikeMcC399 Just updated and can confirm that the runs are now passing. Thank you!

@WtfJoke
Copy link

WtfJoke commented Mar 26, 2025

For us it works too 🎉 thank you!

@jennifer-shehane jennifer-shehane removed the stage: needs information Not enough info to reproduce the issue label Mar 28, 2025
@MikeMcC399
Copy link
Contributor

@DenisHdz

Also, how can we tell which Node version the runner uses? The setup job only logs this:

Current runner version: '2.323.0'
Operating System
  Ubuntu
  [2](https://github.com/x/x/actions/runs/14077865329/job/39424081437#step:1:2)4.04.2
  LTS
Runner Image
  Image: ubuntu-24.04
  Version: 20250[3](https://github.com/x/x/actions/runs/14077865329/job/39424081437#step:1:3)16.1.0
  Included Software: https://github.com/actions/runner-images/blob/ubuntu2[4](https://github.com/x/x/actions/runs/14077865329/job/39424081437#step:1:4)/20250316.1/images/ubuntu/Ubuntu2404-Readme.md
  Image Release: https://github.com/actions/runner-images/releases/tag/ubuntu24%2F202[5](https://github.com/x/x/actions/runs/14077865329/job/39424081437#step:1:5)0316.1
Runner Image Provisioner
  2.0.422.1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants