cypress-io / cypress

Fast, easy and reliable testing for anything that runs in a browser.
https://cypress.io
MIT License
47.02k stars 3.18k forks source link

Errors on execution on Github Action agent #26412

Closed wtachau closed 1 year ago

wtachau commented 1 year ago

Current behavior

Running Cypress on Github Actions, I get a ton of errors like:

[3321:0403/230120.429185:ERROR:object_proxy.cc(623)] Failed to call method: org.freedesktop.DBus.Properties.Get: object_path= /org/freedesktop/UPower: org.freedesktop.DBus.Error.ServiceUnknown: The name org.freedesktop.UPower was not provided by any .service files
[3321:0403/230120.430295:ERROR:object_proxy.cc(623)] Failed to call method: org.freedesktop.UPower.GetDisplayDevice: object_path= /org/freedesktop/UPower: org.freedesktop.DBus.Error.ServiceUnknown: The name org.freedesktop.UPower was not provided by any .service files
[3321:0403/230120.431151:ERROR:object_proxy.cc(623)] Failed to call method: org.freedesktop.UPower.EnumerateDevices: object_path= /org/freedesktop/UPower: org.freedesktop.DBus.Error.ServiceUnknown: The name org.freedesktop.UPower was not provided by any .service files
[3321:0403/230122.382681:ERROR:object_proxy.cc(623)] Failed to call method: org.freedesktop.DBus.Properties.Get: object_path= /org/freedesktop/UPower: org.freedesktop.DBus.Error.ServiceUnknown: The name org.freedesktop.UPower was not provided by any .service files
[3321:0403/230122.384236:ERROR:object_proxy.cc(623)] Failed to call method: org.freedesktop.UPower.GetDisplayDevice: object_path= /org/freedesktop/UPower: org.freedesktop.DBus.Error.ServiceUnknown: The name org.freedesktop.UPower was not provided by any .service files
[3321:0403/230122.385040:ERROR:object_proxy.cc(623)] Failed to call method: org.freedesktop.UPower.EnumerateDevices: object_path= /org/freedesktop/UPower: org.freedesktop.DBus.Error.ServiceUnknown: The name org.freedesktop.UPower was not provided by any .service files
[3321:0403/230125.297689:ERROR:object_proxy.cc(623)] Failed to call method: org.freedesktop.DBus.Properties.Get: object_path= /org/freedesktop/UPower: org.freedesktop.DBus.Error.ServiceUnknown: The name org.freedesktop.UPower was not provided by any .service files
[3321:0403/230125.299023:ERROR:object_proxy.cc(623)] Failed to call method: org.freedesktop.UPower.GetDisplayDevice: object_path= /org/freedesktop/UPower: org.freedesktop.DBus.Error.ServiceUnknown: The name org.freedesktop.UPower was not provided by any .service files
[3321:0403/230125.299889:ERROR:object_proxy.cc(623)] Failed to call method: org.freedesktop.UPower.EnumerateDevices: object_path= /org/freedesktop/UPower: org.freedesktop.DBus.Error.ServiceUnknown: The name org.freedesktop.UPower was not provided by any .service files
[3321:0403/230126.704069:ERROR:object_proxy.cc(623)] Failed to call method: org.freedesktop.DBus.Properties.Get: object_path= /org/freedesktop/UPower: org.freedesktop.DBus.Error.ServiceUnknown: The name org.freedesktop.UPower was not provided by any .service files

It does not fail the tests, but does appear to make them slower (because of all the logging).

Desired behavior

In this situation, Cypress should not show these logs.

Test code to reproduce

Working to try and reproduce, but a simple project does not do it.

Cypress Version

12.9.0

Node version

18

Operating System

Ubuntu 22.04.2

Debug Logs

-04-03T23:34:23.587Z cypress:cli:cli cli starts with arguments ["/opt/hostedtoolcache/node/18.15.0/x64/bin/node","/home/runner/work/map/map/node_modules/.bin/cypress","run","--config","baseUrl=\"http://localhost:3001\""]
2023-04-03T23:34:23.589Z cypress:cli NODE_OPTIONS is not set
2023-04-03T23:34:23.590Z cypress:cli:cli program parsing arguments
3.595Z cypress:cli:cli running Cypress with args [ Command { _events: [Object: null prototype] { 'option:auto-cancel-after-failures': [Function (anonymous)], 'option:browser': [Function (anonymous)], 'option:ci-build-id': [Function (anonymous)], 'option:component': [Function (anonymous)], 'option:config': [Function (anonymous)], 'option:config-file': [Function (anonymous)], 'option:e2e': [Function (anonymous)], 'option:env': [Function (anonymous)], 'option:group': [Function (anonymous)], 'option:key': [Function (anonymous)], 'option:headed': [Function (anonymous)], 'option:headless': [Function (anonymous)], 'option:no-exit': [Function (anonymous)], 'option:parallel': [Function (anonymous)], 'option:port': [Function (anonymous)], 'option:project': [Function (anonymous)], 'option:quiet': [Function (anonymous)], 'option:record': [Function (anonymous)], 'option:reporter': [Function (anonymous)], 'option:reporter-options': [Function (anonymous)], 'option:spec': [Function (anonymous)], 'option:tag': [Function (anonymous)], 'option:dev': [Function (anonymous)] }, _eventsCount: 23, _maxListeners: undefined, commands: [], options: [ [Option], [Option], [Option], [Option], [Option], [Option], [Option], [Option], [Option], [Option], [Option], [Option], [Option], [Option], [Option], [Option], [Option], [Option], [Option], [Option], [Option], [Option], [Option] ], parent: Command { _events: [Object: null prototype], _eventsCount: 1, _maxListeners: undefined, commands: [Array], options: [Array], parent: null, _allowUnknownOption: false, _args: [], rawArgs: [Array], _scriptPath: '/home/runner/work/map/map/node_modules/.bin/cypress', _name: 'cypress', _optionValues: {}, _storeOptionsAsProperties: true, _passCommandToAction: true, _actionResults: [], _actionHandler: null, _executableHandler: false, _executableFile: null, _defaultCommandName: null, _exitCallback: null, _aliases: [], _hidden: false, _helpFlags: '-h, --help', _helpDescription: 'display help for command', _helpShortFlag: '-h', _helpLongFlag: '--help', _hasImplicitHelpCommand: undefined, _helpCommandName: 'help', _helpCommandnameAndArgs: 'help [command]', _helpCommandDescription: 'display help for command', _usage: '<command> [options]', args: [Array], [Symbol(kCapture)]: false }, _allowUnknownOption: false, _args: [], rawArgs: null, _scriptPath: null, _name: 'run', _optionValues: {}, _storeOptionsAsProperties: true, _passCommandToAction: true, _actionResults: [], _actionHandler: [Function: listener], _executableHandler: false, _executableFile: null, _defaultCommandName: null, _exitCallback: null, _aliases: [], _hidden: false, _helpFlags: '-h, --help', _helpDescription: 'display help for command', _helpShortFlag: '-h', _helpLongFlag: '--help', _hasImplicitHelpCommand: 0, _helpCommandName: 'help', _helpCommandnameAndArgs: 'help [command]', _helpCommandDescription: 'display help for command', _usage: '[options]', _description: 'Runs Cypress tests from the CLI without the GUI', _argsDescription: undefined, exit: true, config: 'baseUrl="http://localhost:3001"', args: [], [Symbol(kCapture)]: false } ]
3.740Z cypress:cli:cli variable-length opts parsed { args: [ '/opt/hostedtoolcache/node/18.15.0/x64/bin/node', '/home/runner/work/map/map/node_modules/.bin/cypress', 'run', '--config', 'baseUrl="http://localhost:3001"' ], opts: Command { _events: [Object: null prototype] { 'option:auto-cancel-after-failures': [Function (anonymous)], 'option:browser': [Function (anonymous)], 'option:ci-build-id': [Function (anonymous)], 'option:component': [Function (anonymous)], 'option:config': [Function (anonymous)], 'option:config-file': [Function (anonymous)], 'option:e2e': [Function (anonymous)], 'option:env': [Function (anonymous)], 'option:group': [Function (anonymous)], 'option:key': [Function (anonymous)], 'option:headed': [Function (anonymous)], 'option:headless': [Function (anonymous)], 'option:no-exit': [Function (anonymous)], 'option:parallel': [Function (anonymous)], 'option:port': [Function (anonymous)], 'option:project': [Function (anonymous)], 'option:quiet': [Function (anonymous)], 'option:record': [Function (anonymous)], 'option:reporter': [Function (anonymous)], 'option:reporter-options': [Function (anonymous)], 'option:spec': [Function (anonymous)], 'option:tag': [Function (anonymous)], 'option:dev': [Function (anonymous)] }, _eventsCount: 23, _maxListeners: undefined, commands: [], options: [ [Option], [Option], [Option], [Option], [Option], [Option], [Option], [Option], [Option], [Option], [Option], [Option], [Option], [Option], [Option], [Option], [Option], [Option], [Option], [Option], [Option], [Option], [Option] ], parent: Command { _events: [Object: null prototype], _eventsCount: 1, _maxListeners: undefined, commands: [Array], options: [Array], parent: null, _allowUnknownOption: false, _args: [], rawArgs: [Array], _scriptPath: '/home/runner/work/map/map/node_modules/.bin/cypress', _name: 'cypress', _optionValues: {}, _storeOptionsAsProperties: true, _passCommandToAction: true, _actionResults: [], _actionHandler: null, _executableHandler: false, _executableFile: null, _defaultCommandName: null, _exitCallback: null, _aliases: [], _hidden: false, _helpFlags: '-h, --help', _helpDescription: 'display help for command', _helpShortFlag: '-h', _helpLongFlag: '--help', _hasImplicitHelpCommand: undefined, _helpCommandName: 'help', _helpCommandnameAndArgs: 'help [command]', _helpCommandDescription: 'display help for command', _usage: '<command> [options]', args: [Array], [Symbol(kCapture)]: false }, _allowUnknownOption: false, _args: [], rawArgs: null, _scriptPath: null, _name: 'run', _optionValues: {}, _storeOptionsAsProperties: true, _passCommandToAction: true, _actionResults: [], _actionHandler: [Function: listener], _executableHandler: false, _executableFile: null, _defaultCommandName: null, _exitCallback: null, _aliases: [], _hidden: false, _helpFlags: '-h, --help', _helpDescription: 'display help for command', _helpShortFlag: '-h', _helpLongFlag: '--help', _hasImplicitHelpCommand: 0, _helpCommandName: 'help', _helpCommandnameAndArgs: 'help [command]', _helpCommandDescription: 'display help for command', _usage: '[options]', _description: 'Runs Cypress tests from the CLI without the GUI', _argsDescription: undefined, exit: true, config: 'baseUrl="http://localhost:3001"', args: [], [Symbol(kCapture)]: false } }
2023-04-03T23:34:23.742Z cypress:cli parsed cli options { config: 'baseUrl="http://localhost:3001"' }
2023-04-03T23:34:23.743Z cypress:cli verifying Cypress app
2023-04-03T23:34:23.743Z cypress:cli Using CYPRESS_CACHE_FOLDER from environment variable
2023-04-03T23:34:23.743Z cypress:cli Using CYPRESS_CACHE_FOLDER from environment variable
2023-04-03T23:34:23.744Z cypress:cli using environment variable CYPRESS_CACHE_FOLDER /home/runner/.cache/Cypress
2023-04-03T23:34:23.745Z cypress:cli checking environment variables
2023-04-03T23:34:23.748Z cypress:cli checking if executable exists /home/runner/.cache/Cypress/12.9.0/Cypress/Cypress
2023-04-03T23:34:23.759Z cypress:cli Binary is executable? : true
2023-04-03T23:34:23.759Z cypress:cli binaryDir is  /home/runner/.cache/Cypress/12.9.0/Cypress
2023-04-03T23:34:23.759Z cypress:cli Reading binary package.json from: /home/runner/.cache/Cypress/12.9.0/Cypress/resources/app/package.json
2023-04-03T23:34:23.766Z cypress:cli Found binary version 12.9.0 installed in: /home/runner/.cache/Cypress/12.9.0/Cypress
2023-04-03T23:34:23.767Z cypress:cli { verified: true }
2023-04-03T23:34:23.767Z cypress:cli is Verified ? true
2023-04-03T23:34:23.768Z cypress:cli:run processing run options { config: 'baseUrl="http://localhost:3001"', key: null, spec: null, reporter: null, reporterOptions: null, project: '/home/runner/work/map/map' }
2023-04-03T23:34:23.768Z cypress:cli:run --key is not set, looking up environment variable CYPRESS_RECORD_KEY
2023-04-03T23:34:23.768Z cypress:cli:run run to spawn.start args ["--run-project","/home/runner/work/map/map","--config","baseUrl=\"http://localhost:3001\""]
2023-04-03T23:34:23.769Z cypress:cli undefined DISPLAY environment variable
2023-04-03T23:34:23.769Z cypress:cli Cypress will spawn its own Xvfb
2023-04-03T23:34:23.769Z cypress:cli Using CYPRESS_CACHE_FOLDER from environment variable
2023-04-03T23:34:23.769Z cypress:cli Using CYPRESS_CACHE_FOLDER from environment variable
2023-04-03T23:34:23.769Z cypress:cli using environment variable CYPRESS_CACHE_FOLDER /home/runner/.cache/Cypress
2023-04-03T23:34:23.769Z cypress:cli needs to start own Xvfb? true
2023-04-03T23:34:23.770Z cypress:cli Starting Xvfb
2023-04-03T23:34:23.814Z cypress:cli spawning, should retry on display problem? false
2023-04-03T23:34:23.824Z cypress:cli passing DISPLAY :99
2023-04-03T23:34:23.825Z cypress:cli spawn args [ '--no-sandbox', '--', '--run-project', '/home/runner/work/map/map', '--config', 'baseUrl="http://localhost:3001"', '--cwd', '/home/runner/work/map/map', '--userNodePath', '/opt/hostedtoolcache/node/18.15.0/x64/bin/node', '--userNodeVersion', '18.15.0' ] { detached: false, stdio: [ 'inherit', 'inherit', 'pipe' ] }
2023-04-03T23:34:23.825Z cypress:cli spawning Cypress with executable: /home/runner/.cache/Cypress/12.9.0/Cypress/Cypress
2023-04-03T23:34:23.829Z cypress:cli piping child STDERR to process STDERR
  cypress:snapshot:info Caching 3498, defining 4411 modules! Using cache +0ms
  cypress:snapshot:debug initializing packherd require +0ms
  cypress:server:appdata path: /home/runner/.config/Cypress/cy/production/browsers +0ms
  cypress:server:cypress starting cypress with argv [ '/home/runner/.cache/Cypress/12.9.0/Cypress/Cypress', '--no-sandbox', '--', '--run-project', '/home/runner/work/map/map', '--config', 'baseUrl="http://localhost:3001"', '--cwd', '/home/runner/work/map/map', '--userNodePath', '/opt/hostedtoolcache/node/18.15.0/x64/bin/node', '--userNodeVersion', '18.15.0' ] +0ms
  cypress:server:args argv array: [ '/home/runner/.cache/Cypress/12.9.0/Cypress/Cypress', '--no-sandbox', '--run-project', '/home/runner/work/map/map', '--config', 'baseUrl="http://localhost:3001"', '--cwd', '/home/runner/work/map/map', '--userNodePath', '/opt/hostedtoolcache/node/18.15.0/x64/bin/node', '--userNodeVersion', '18.15.0' ] +0ms
  cypress:server:args parsed argv options { options: { _: [ '/home/runner/.cache/Cypress/12.9.0/Cypress/Cypress' ], sandbox: false, 'run-project': '/home/runner/work/map/map', runProject: '/home/runner/work/map/map', config: 'baseUrl="http://localhost:3001"', cwd: '/home/runner/work/map/map', userNodePath: '/opt/hostedtoolcache/node/18.15.0/x64/bin/node', userNodeVersion: '18.15.0' } } +3ms

Other

This is a follow-up to this issue: https://github.com/cypress-io/cypress/issues/23641

wtachau commented 1 year ago

FYI the debug logs are 50MB but I am happy to send them :)

emilyrohrbough commented 1 year ago

@wtachau Is this an issue with running tests in Azure or in Github Actions?

wtachau commented 1 year ago

Github Actions!

wtachau commented 1 year ago

Oh sorry, I realize the title was confusing (I just copied it over from the previous issue). Updated it to be more accurate.

emilyrohrbough commented 1 year ago

Ah gottchya! No worries. Can you please share you general CI setup? The debug logs without context to how this is set up and how you are running cypress don't help a ton by them selves.

wtachau commented 1 year ago

Hi Emily, no problem. See below:

name: Integration Tests
on:
  push:
    branches:
      - 'main'
  pull_request:

concurrency:
  group: build-${{ github.event.pull_request.number || github.ref }}
  cancel-in-progress: true

env:
  GOOGLE_OAUTH_CLIENT_ID: foo
  GOOGLE_OAUTH_CLIENT_SECRET: bar
  DATABASE_URL: postgresql://postgres:password@localhost/map_local_test?schema=public
  DATABASE_TEST_URL: postgresql://postgres:password@localhost/map_local_test?schema=public
  DIRECT_URL: postgresql://postgres:password@localhost/map_local_test?schema=public

jobs:
  Cypress:
    runs-on: ubuntu-latest

    # Service containers to run with `runner-job`
    services:
      # Label used to access the service container
      postgres:
        # Docker Hub image
        image: postgres
        # Provide the password for postgres
        env:
          POSTGRES_USER: postgres
          POSTGRES_PASSWORD: password
          POSTGRES_DB: map_local_test
        # Set health checks to wait until postgres has started
        options: >-
          --health-cmd pg_isready
          --health-interval 10s
          --health-timeout 5s
          --health-retries 5
        ports:
          # Maps tcp port 5432 on service container to the host
          - 5432:5432

    steps:
      - name: Setup Node
        uses: actions/setup-node@v3
        with:
          node-version: 18

      - name: Checkout
        uses: actions/checkout@v3

      - name: Setup database
        run: yarn && yarn migrate

      - name: Cypress tests
        uses: cypress-io/github-action@v4
        with:
          command: yarn cypress
          record: false
wtachau commented 1 year ago

FYI I confirmed that downgrading to cypress 12.5.1 fixed this for me

MikeMcC399 commented 1 year ago

@wtachau

FYI I confirmed that downgrading to cypress 12.5.1 fixed this for me

Interesting you found a workaround!

 - name: Cypress tests
   uses: cypress-io/github-action@v4
    with:
     command: yarn cypress
     record: false

Just by the way: the latest version of the action is called with cypress-io/github-action@v5. I don't expect that to change anything significant with regard to this issue, but new fixes only flow into the v5 version. v4 is effectively frozen.

wtachau commented 1 year ago

Ah, good to know, thank you!

MikeMcC399 commented 1 year ago

@wtachau

Did you check that the runner you are using fits the Cypress Hardware dimensioning recommendations?

If you are using a GitHub-hosted runner, you can find the specs on Supported runners and hardware resources.

wtachau commented 1 year ago

Here is the runner information:

Current runner version: '2.303.0'
Operating System
  Ubuntu
  [2](https://github.com/nemo-org/map/actions/runs/4599540148/jobs/8125030508#step:1:2)2.04.2
  LTS
Runner Image
  Image: ubuntu-22.04
  Version: 202[3](https://github.com/nemo-org/map/actions/runs/4599540148/jobs/8125030508#step:1:3)0326.2
  Included Software: https://github.com/actions/runner-images/blob/ubuntu22/20230326.2/images/linux/Ubuntu220[4](https://github.com/nemo-org/map/actions/runs/4599540148/jobs/8125030508#step:1:4)-Readme.md
  Image Release: https://github.com/actions/runner-images/releases/tag/ubuntu22%2F20230326.2
Runner Image Provisioner
  2.0.139.1
GITHUB_TOKEN Permissions
  Actions: read
  Checks: read
  Contents: read
  Deployments: read
  Discussions: read
  Issues: read
  Metadata: read
  Packages: read
  Pages: read
  PullRequests: read
  RepositoryProjects: read
  SecurityEvents: read
  Statuses: read
Secret source: Dependabot
Prepare workflow directory
Prepare all required actions
Getting action download info
Download action repository 'actions/setup-node@v3' (SHA:64ed1c7eab4cce3362f8c340dee64e[5](https://github.com/nemo-org/map/actions/runs/4599540148/jobs/8125030508#step:1:5)eaeef8f7c)
Download action repository 'actions/checkout@v3' (SHA:8f4b7f848[6](https://github.com/nemo-org/map/actions/runs/4599540148/jobs/8125030508#step:1:7)4484a[7](https://github.com/nemo-org/map/actions/runs/4599540148/jobs/8125030508#step:1:8)bf31766abe9204da3cbe65b3)
Download action repository 'cypress-io/github-action@v4' (SHA:d79d2d530a66e641eb4a5f227e13bc9[8](https://github.com/nemo-org/map/actions/runs/4599540148/jobs/8125030508#step:1:9)5c60b[9](https://github.com/nemo-org/map/actions/runs/4599540148/jobs/8125030508#step:1:10)64)
Complete job name: Cypress

Since we're also running Postgres in a service container, perhaps we should have 3 CPUs? Otherwise it looks like the hardware specifications for Github are sufficient.

Even if that's the case, it seems undesirable for the upgrade from 12.5.1 to 12.9.0 to start causing all these logs with the out-of-the-box Github Actions configuration (runs-on: ubuntu-latest).

emilyrohrbough commented 1 year ago

@wtachau When these logs are occurring, are they just on start-up or throughout then entire test duration? Did you start to experience this issue after upgrading to 12.9.0 from 12.5.1 or what prompted looking at downgrading?

emilyrohrbough commented 1 year ago

I am curious when this started because it looks like your Github Actions executor is using ubuntu-latest which is updated weekly per the actions/runner-images release candace.

This error appear to be possibly related to https://bbs.archlinux.org/viewtopic.php?id=236020 given this is a linux distribution. It seems "harmless" and related to the linux setup, but not nice to hear it's slowing things down.

GPU acceleration is disabled for linux machines when launch Cypress, and should be disabled when launching the Electron browser, which is the default Cypress browser. Do you see these logs when testing in Chrome? (even if this isn't the long-term goal)

MikeMcC399 commented 1 year ago

@wtachau

[3321:0403/230120.429185:ERROR:object_proxy.cc(623)] Failed to call method: org.freedesktop.DBus.Properties.Get: object_path= /org/freedesktop/UPower: org.freedesktop.DBus.Error.ServiceUnknown: The name org.freedesktop.UPower was not provided by any .service files

Working to try and reproduce, but a simple project does not do it.

Since we're also running Postgres in a service container, perhaps we should have 3 CPUs? Otherwise it looks like the hardware specifications for Github are sufficient.

This is an operating system error rather than a Cypress error. If you can't reproduce it with a simple project and you are getting the error only on full load then it may be a dimensioning issue. It sounds like you are running with the default Ubuntu hardware:

Hardware specification for Windows and Linux virtual machines:

which is less than the recommended for your case, as you implied.

Do you have the possibility to use GitHub's Larger runners?

wtachau commented 1 year ago

When these logs are occurring, are they just on start-up or throughout then entire test duration? They are throughout the entire test duration.

Did you start to experience this issue after upgrading to 12.9.0 from 12.5.1 or what prompted looking at downgrading? We actually started seeing this on an unrelated commit (a short front-end change), thought it was around the same time, which led to the speculation about downgrading Cypress. That seemed to have worked, though.

I have not tried running these tests in headless Chrome— I will try and report back.

We do have the ability to use Github's larger runners, though we haven't enabled them yet— we are trying to be cost-conscious, and until recently the standard runners were totally fine. It's also worth mentioning we have't added any Cypress tests recently, so I don't imagine running the tests has become more intensive.

mschile commented 1 year ago

Unfortunately we have to close this issue due to inactivity. Please comment if there is new information to provide concerning the original issue and we can reopen.