Skip to content
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

Cypress 8.0.0: A system error occurred: uv_os_get_passwd returned ENOENT (no such file or directory) on Docker #17415

Closed
knorrium opened this issue Jul 21, 2021 · 7 comments · Fixed by #17488
Assignees
Labels

Comments

@knorrium
Copy link

Current behavior

After updating to Cypress 8.0.0, running Firefox on Docker through Github Actions no longer works.

  cypress:server:appdata path: /github/home/.config/Cypress/cy/production +379ms
  cypress:server:appdata path: /github/home/.config/Cypress/cy/production/cache +111ms
  cypress:server:cypress exiting with err SystemError [ERR_SYSTEM_ERROR]: A system error occurred: uv_os_get_passwd returned ENOENT (no such file or directory)
    at Object.userInfo (os.js:270:11)
    at new File (/github/home/.cache/Cypress/8.0.0/Cypress/resources/app/packages/server/lib/util/file.js:26:62)
    at Object.<anonymous> (/github/home/.cache/Cypress/8.0.0/Cypress/resources/app/packages/server/lib/cache.js:8:18)
    at Module._compile (internal/modules/cjs/loader.js:1078:30)

It seems to have been introduced by this line

this._lockFileDir = path.join(os.tmpdir(), `cypress-${os.userInfo().uid}`)

This is happening because os.userInfo() throws when the user has no username, which is the case when running with options: --user 1001, needed to run Firefox as non-root.

Desired behavior

Running tests on Firefox works :)

Test code to reproduce

Setup a repo with a step to run tests on Firefox using Docker and Github Actions, similar to https://github.com/cypress-io/github-action#firefox - my config uses cypress/browsers:node14.17.0-chrome88-ff89 instead.

To see it failing isolated from Cypress, add the following step to just call os.userInfo() inline:

      - name: debug node userinfo
        run: node -e "console.log(os.userInfo());"

Screen Shot 2021-07-20 at 11 41 37 PM

Cypress Version

8.0.0

Other

No response

@snappyjs
Copy link

i get the exact same error in github actions. Started getting when running tests today. If you run on ubuntu-latest it works though! So that's a workaround until it's fixed in the container from cypress for anyone that finds this issue.

@edouard-lopez
Copy link

@snappyjs I'm using ubuntu-latest but have the error. My job is run under following Github environmment:

Current runner version: '2.278.0'
Operating System
  Ubuntu
  20.04.2
  LTS
Virtual Environment
  Environment: ubuntu-20.04
  Version: 20210718.1
  Included Software: actions/virtual-environments@ubuntu20/20210718.1/images/linux/Ubuntu2004-README.md
  Image Release: actions/virtual-environments@ubuntu20%2F20210718.1 (release)

My stacktrace

A system error occurred: uv_os_get_passwd returned ENOENT (no such file or directory)
SystemError [ERR_SYSTEM_ERROR]: A system error occurred: uv_os_get_passwd returned ENOENT (no such file or directory)
    at Object.userInfo (os.js:270:11)
    at new File (/github/home/.cache/Cypress/8.0.0/Cypress/resources/app/packages/server/lib/util/file.js:26:62)
    at Object.<anonymous> (/github/home/.cache/Cypress/8.0.0/Cypress/resources/app/packages/server/lib/cache.js:8:18)
    at Module._compile (internal/modules/cjs/loader.js:1078:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1108:10)
    at Module.load (internal/modules/cjs/loader.js:935:32)
    at Module._load (internal/modules/cjs/loader.js:776:14)
    at Function.f._load (electron/js2c/asar_bundle.js:5:12789)
    at Module.require (internal/modules/cjs/loader.js:959:19)
    at require (internal/modules/cjs/helpers.js:88:18)
    at Object.<anonymous> (/github/home/.cache/Cypress/8.0.0/Cypress/resources/app/packages/server/lib/project_static.js:10:41)
    at Module._compile (internal/modules/cjs/loader.js:1078:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1108:10)
    at Module.load (internal/modules/cjs/loader.js:935:32)
    at Module._load (internal/modules/cjs/loader.js:776:14)
    at Function.f._load (electron/js2c/asar_bundle.js:5:12789)
    at Module.require (internal/modules/cjs/loader.js:959:19)
    at require (internal/modules/cjs/helpers.js:88:18)
    at Object.<anonymous> (/github/home/.cache/Cypress/8.0.0/Cypress/resources/app/packages/server/lib/modes/run.js:14:23)
    at Module._compile (internal/modules/cjs/loader.js:1078:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1108:10)
    at Module.load (internal/modules/cjs/loader.js:935:32)
    at Module._load (internal/modules/cjs/loader.js:776:14)
    at Function.f._load (electron/js2c/asar_bundle.js:5:12789)
    at Module.require (internal/modules/cjs/loader.js:959:19)
    at require (internal/modules/cjs/helpers.js:88:18)
    at Object.run (/github/home/.cache/Cypress/8.0.0/Cypress/resources/app/packages/server/lib/modes/run-e2e.js:2:10)
    at module.exports (/github/home/.cache/Cypress/8.0.0/Cypress/resources/app/packages/server/lib/modes/index.js:11:33)
    at /github/home/.cache/Cypress/8.0.0/Cypress/resources/app/packages/server/lib/cypress.js:86:34
From previous event:
    at Object.runElectron (/github/home/.cache/Cypress/8.0.0/Cypress/resources/app/packages/server/lib/cypress.js:72:23)
    at Object.startInMode (/github/home/.cache/Cypress/8.0.0/Cypress/resources/app/packages/server/lib/cypress.js:249:21)
    at /github/home/.cache/Cypress/8.0.0/Cypress/resources/app/packages/server/lib/cypress.js:186:19
    at /github/home/.cache/Cypress/8.0.0/Cypress/resources/app/packages/server/node_modules/fs-extra/lib/mkdirs/mkdirs.js:37:14
    at FSReqCallback.oncomplete (fs.js:171:23)
From previous event:
    at Object.start (/github/home/.cache/Cypress/8.0.0/Cypress/resources/app/packages/server/lib/cypress.js:162:6)
    at Object.<anonymous> (/github/home/.cache/Cypress/8.0.0/Cypress/resources/app/packages/server/index.js:39:43)
    at Module._compile (internal/modules/cjs/loader.js:1078:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1108:10)
    at Module.load (internal/modules/cjs/loader.js:935:32)
    at Module._load (internal/modules/cjs/loader.js:776:14)
    at Function.f._load (electron/js2c/asar_bundle.js:5:12789)
    at Module.require (internal/modules/cjs/loader.js:959:19)
    at require (internal/modules/cjs/helpers.js:88:18)
    at Object.<anonymous> (/github/home/.cache/Cypress/8.0.0/Cypress/resources/app/index.js:2:1)
    at Module._compile (internal/modules/cjs/loader.js:1078:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1108:10)
    at Module.load (internal/modules/cjs/loader.js:935:32)
    at Module._load (internal/modules/cjs/loader.js:776:14)
    at Function.f._load (electron/js2c/asar_bundle.js:5:12789)
    at Object.<anonymous> (electron/js2c/browser_init.js:197:3243)
    at Object../lib/browser/init.ts (electron/js2c/browser_init.js:197:3447)
    at __webpack_require__ (electron/js2c/browser_init.js:1:128)
    at electron/js2c/browser_init.js:1:1200
    at electron/js2c/browser_init.js:1:1267
    at NativeModule.compileForInternalLoader (internal/bootstrap/loaders.js:278:7)
    at NativeModule.compileForPublicLoader (internal/bootstrap/loaders.js:220:10)
    at loadNativeModule (internal/modules/cjs/helpers.js:35:9)
    at Module._load (internal/modules/cjs/loader.js:747:15)
    at Function.f._load (electron/js2c/asar_bundle.js:5:12789)
    at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:72:12)
    at internal/main/run_main_module.js:17:47
os.js:270
    throw new ERR_SYSTEM_ERROR(ctx);
    ^

SystemError [ERR_SYSTEM_ERROR]: A system error occurred: uv_os_get_passwd returned ENOENT (no such file or directory)
    at Object.userInfo (os.js:270:11)
    at new File (/github/home/.cache/Cypress/8.0.0/Cypress/resources/app/packages/server/lib/util/file.js:26:62)
    at Object.<anonymous> (/github/home/.cache/Cypress/8.0.0/Cypress/resources/app/packages/server/lib/cache.js:8:18)
    at Module._compile (internal/modules/cjs/loader.js:1078:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1108:10)
    at Module.load (internal/modules/cjs/loader.js:935:32)
    at Module._load (internal/modules/cjs/loader.js:776:14)
    at Function.f._load (electron/js2c/asar_bundle.js:5:12789)
    at Module.require (internal/modules/cjs/loader.js:959:19)
    at require (internal/modules/cjs/helpers.js:88:18)
    at Object.<anonymous> (/github/home/.cache/Cypress/8.0.0/Cypress/resources/app/packages/server/lib/user.js:3:15)
    at Module._compile (internal/modules/cjs/loader.js:1078:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1108:10)
    at Module.load (internal/modules/cjs/loader.js:935:32)
    at Module._load (internal/modules/cjs/loader.js:776:14)
    at Function.f._load (electron/js2c/asar_bundle.js:5:12789)
    at Module.require (internal/modules/cjs/loader.js:959:19)
    at require (internal/modules/cjs/helpers.js:88:18)
    at Object.<anonymous> (/github/home/.cache/Cypress/8.0.0/Cypress/resources/app/packages/server/lib/exception.js:5:14)
    at Module._compile (internal/modules/cjs/loader.js:1078:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1108:10)
    at Module.load (internal/modules/cjs/loader.js:935:32)
    at Module._load (internal/modules/cjs/loader.js:776:14)
    at Function.f._load (electron/js2c/asar_bundle.js:5:12789)
    at Module.require (internal/modules/cjs/loader.js:959:19)
    at require (internal/modules/cjs/helpers.js:88:18)
    at exports.Logger.logger.createException (/github/home/.cache/Cypress/8.0.0/Cypress/resources/app/packages/server/lib/logger.js:60:10)
    at exports.Logger.logger.defaultErrorHandler (/github/home/.cache/Cypress/8.0.0/Cypress/resources/app/packages/server/lib/logger.js:92:10)
    at exports.Logger.exitOnError (/github/home/.cache/Cypress/8.0.0/Cypress/resources/app/packages/server/lib/logger.js:54:19)
    at exports.Logger.Logger._uncaughtException (/github/home/.cache/Cypress/8.0.0/Cypress/resources/app/packages/server/node_modules/winston/lib/winston/logger.js:645:12)
    at process.emit (events.js:327:22)
    at processEmit [as emit] (/github/home/.cache/Cypress/8.0.0/Cypress/resources/app/packages/server/node_modules/signal-exit/index.js:161:32)
    at process._fatalException (internal/process/execution.js:156:25) {
  code: 'ERR_SYSTEM_ERROR',
  info: {
    errno: -2,
    code: 'ENOENT',
    message: 'no such file or directory',
    syscall: 'uv_os_get_passwd'
  },
  errno: [Getter/Setter],
  syscall: [Getter/Setter]
}
Test run failed, code 7
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

@flotwig
Copy link
Contributor

flotwig commented Jul 23, 2021

The issue can be avoided on POSIX by using process.geteuid(), which bypasses /etc/passwd and this error.

But on Windows, it throws:

image

(also, isn't it funny how os.userInfo throws when there's no username on Linux, but returns a mock uid when on Windows? 🤷)

So I'll submit a PR to use geteuid on Linux/Darwin, and a static userId on Windows.

@Seitar18
Copy link

Seitar18 commented Jul 26, 2021

Got the same issue on GitLab CI and Chrome, running with k8s from root and non-root on the run official latest cypress chrome and node image:
https://hub.docker.com/r/cypress/browsers/tags?page=1&ordering=last_updated

@cypress-bot
Copy link
Contributor

cypress-bot bot commented Jul 30, 2021

The code for this is done in cypress-io/cypress#17488, but has yet to be released.
We'll update this issue and reference the changelog when it's released.

@cypress-bot cypress-bot bot added stage: pending release and removed stage: needs review The PR code is done & tested, needs review labels Jul 30, 2021
@snappyjs
Copy link

snappyjs commented Aug 1, 2021

@edouard-lopez I'm running the below config - and that's working fine (just ran it right now and successfully ran all tests). It's running on firefox90 (since that's the browser that comes with ubuntu-latest on github runners).

One issue is that I don't get any recorded video though. Probably since it's missing some package to do the recording in the github runner.
(I've just commended the container information below)

#Run Cypress tests for firefox
  ui-firefox-tests:
    name: Firefox Tests
    runs-on: ubuntu-latest
      #container:
      #  image: cypress/browsers:node14.17.0-chrome91-ff89
      # options: --user 1001
    needs: build

    steps:
      - name: Checkout
        uses: actions/checkout@v2

      - name: Download build artifact
        uses: actions/download-artifact@v2
        with:
          name: build
          path: .next

      - name: UI Tests Firefox
        uses: cypress-io/github-action@v2
        with:
          install: npm install
          wait-on: "http://localhost:3000"
          wait-on-timeout: 120
          browser: firefox
          record: true
          group: "UI - Firefox"
          spec: cypress/integration/**/*.spec.ts
          start: npm start
        env:
          CYPRESS_PROJECT_ID: ${{ secrets.CYPRESS_PROJECT_ID }}
          CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }}
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

@cypress-bot
Copy link
Contributor

cypress-bot bot commented Aug 4, 2021

Released in 8.2.0.

This comment thread has been locked. If you are still experiencing this issue after upgrading to
Cypress v8.2.0, please open a new issue.

@cypress-bot cypress-bot bot locked as resolved and limited conversation to collaborators Aug 4, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants