cypress-io / cypress

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

Silence dbus errors - fix does not seem to work in 13.6.0 #28421

Open kriehzoo opened 7 months ago

kriehzoo commented 7 months ago

Current behavior

In the scope of issue 19299 dbus error messages were silenced but it does not seem to work as expected.

When running cypress in docker on gitlab on premises, I see the following output in the build log:

$ npm run cy:run

myproject@1.0.0 cy:run cypress run --env host=https://mydomain.com --headless [STARTED] Task without title. [FAILED] Cypress failed to start. [FAILED] [FAILED] This may be due to a missing library or dependency. https://on.cypress.io/required-dependencies [FAILED] [FAILED] Please refer to the error below for more details. [FAILED] [FAILED] ---------- [FAILED] [FAILED] [148:1123/161940.290088:ERROR:bus.cc(399)] Failed to connect to the bus: Failed to connect to socket /run/dbus/system_bus_socket: No such file or directory [FAILED] [FAILED] ---------- [FAILED] [FAILED] Platform: linux-x64 (Debian - 11.4) [FAILED] Cypress Version: 13.6.0 Cypress failed to start.

This may be due to a missing library or dependency. https://on.cypress.io/required-dependencies Please refer to the error below for more details.

[148:1123/161940.290088:ERROR:bus.cc(399)] Failed to connect to the bus: Failed to connect to socket /run/dbus/system_bus_socket: No such file or directory

Platform: linux-x64 (Debian - 11.4) Cypress Version: 13.6.0

I checked the source for tags/v13.6.0 and lib/exec/spawn.js contains the relevant lines:

// https://github.com/cypress-io/cypress/issues/19299
const isDbusWarning = /Failed to connect to the bus:/

and

const GARBAGE_WARNINGS = [isXlibOrLibudevRe, isHighSierraWarningRe, isRenderWorkerRe, isDbusWarning, isCertVerifyProcBuiltin, isMacOSElectronWebSwapCGLLayerWarning]

I understand that the dbus messages are probably not the issue and may be ignored, but I do not understand why they are printed. Could you pls take a look?

Desired behavior

Dbus messages should not be printed.

Test code to reproduce

The simplest way to reproduce those issues is to run cypress:verify with the cypress included docker image, or directly the following command inside the docker container.

root@myhost:/home/myuser# docker run --name cypress -it --rm -v /var/run/dbus/system_bus_socket:/var/run/dbus/system_bus_socket --entrypoint /bin/bash --security-opt=apparmor=unconfined cypress/included:13.6.0 root@b932578ec0d0:/# /root/.cache/Cypress/13.6.0/Cypress/Cypress --no-sandbox --smoke-test --ping=626 --headless [7:1127/171733.443657:ERROR:bus.cc(399)] Failed to connect to the bus: Address does not contain a colon [7:1127/171733.443762:ERROR:bus.cc(399)] Failed to connect to the bus: Address does not contain a colon [7:1127/171733.443801:ERROR:bus.cc(399)] Failed to connect to the bus: Address does not contain a colon [7:1127/171733.443829:ERROR:bus.cc(399)] Failed to connect to the bus: Address does not contain a colon

DevTools listening on ws://127.0.0.1:37459/devtools/browser/c0394357-9e9d-4a94-9c12-87685dc79219 [7:1127/171733.468057:ERROR:object_proxy.cc(590)] Failed to call method: org.freedesktop.portal.Settings.Read: object_path= /org/freedesktop/portal/desktop: unknown error type: It looks like you are running the Cypress binary directly.

This is not the recommended approach, and Cypress may not work correctly.

Please install the cypress NPM package and follow the instructions here:

https://on.cypress.io/installing-cypress 626

Cypress Version

13.6.0

Node version

18.6.0

Operating System

Platform: linux-x64 (Debian - 11.4)

Debug Logs

root@d242b8078701:/# ELECTRON_ENABLE_LOGGING=true DEBUG=cypress:* /root/.cache/Cypress/13.6.0/Cypress/Cypress --no-sandbox --smoke-test --ping=626 --headless --disable-gpu
[188:1129/081520.659244:ERROR:bus.cc(399)] Failed to connect to the bus: Failed to connect to socket /run/dbus/system_bus_socket: No such file or directory
  cypress:snapshot:info Caching 3470, defining 4295 modules! Using cache +0ms
  cypress:snapshot:debug initializing packherd require +0ms
  cypress:server:performance-benchmark elapsed time at v8-snapshot-startup-time: 300.77ms +0ms
  cypress:server:appdata path: /root/.config/Cypress/cy/production/browsers +0ms
  cypress:server:cypress starting cypress with argv [ '/root/.cache/Cypress/13.6.0/Cypress/Cypress', '--no-sandbox', '--smoke-test', '--ping=626', '--headless', '--disable-gpu' ] +0ms
  cypress:server:args argv array: [ '/root/.cache/Cypress/13.6.0/Cypress/Cypress', '--no-sandbox', '--smoke-test', '--ping=626', '--headless', '--disable-gpu' ] +0ms
  cypress:server:args parsed argv options { options: { _: [ '/root/.cache/Cypress/13.6.0/Cypress/Cypress' ], sandbox: false, 'smoke-test': true, smokeTest: true, ping: 626, headless: true, 'disable-gpu': true } } +2ms
  cypress:server:args argv parsed: { _: [ '/root/.cache/Cypress/13.6.0/Cypress/Cypress' ], sandbox: false, smokeTest: true, ping: 626, headless: true, 'disable-gpu': true, invokedFromCli: false, cwd: '/' } +7ms
  cypress:server:util:proxy found proxy environment variables {} +0ms
  cypress:server:args options { _: [ '/root/.cache/Cypress/13.6.0/Cypress/Cypress' ], sandbox: false, smokeTest: true, ping: 626, headless: true, 'disable-gpu': true, invokedFromCli: false, cwd: '/', config: {} } +5ms
  cypress:server:args argv options: { _: [ '/root/.cache/Cypress/13.6.0/Cypress/Cypress' ], sandbox: false, smokeTest: true, ping: 626, headless: true, 'disable-gpu': true, invokedFromCli: false, cwd: '/', config: {}, pong: 626 } +1ms
  cypress:server:cypress from argv [ '/root/.cache/Cypress/13.6.0/Cypress/Cypress', '--no-sandbox', '--smoke-test', '--ping=626', '--headless', '--disable-gpu' ] got options { _: [ '/root/.cache/Cypress/13.6.0/Cypress/Cypress' ], sandbox: false, smokeTest: true, ping: 626, headless: true, 'disable-gpu': true, invokedFromCli: false, cwd: '/', config: {}, pong: 626 } +18ms
[188:1129/081521.659051:ERROR:bus.cc(399)] Failed to connect to the bus: Failed to connect to socket /run/dbus/system_bus_socket: No such file or directory
[188:1129/081521.659148:ERROR:bus.cc(399)] Failed to connect to the bus: Failed to connect to socket /run/dbus/system_bus_socket: No such file or directory
[188:1129/081521.660734:ERROR:bus.cc(399)] Failed to connect to the bus: Address does not contain a colon
[188:1129/081521.660817:ERROR:bus.cc(399)] Failed to connect to the bus: Address does not contain a colon
[188:1129/081521.660843:ERROR:bus.cc(399)] Failed to connect to the bus: Address does not contain a colon
[188:1129/081521.660865:ERROR:bus.cc(399)] Failed to connect to the bus: Address does not contain a colon
  cypress:server:appdata path: /root/.config/Cypress/cy/production +101ms

DevTools listening on ws://127.0.0.1:34931/devtools/browser/e107398f-0345-4995-a770-c07a3ea65e2d
[188:1129/081521.686469:WARNING:bluez_dbus_manager.cc(247)] Floss manager not present, cannot set Floss enable/disable.
[188:1129/081521.686637:ERROR:object_proxy.cc(590)] Failed to call method: org.freedesktop.portal.Settings.Read: object_path= /org/freedesktop/portal/desktop: unknown error type: 
[342:1129/081521.687014:WARNING:sandbox_linux.cc(393)] InitializeSandbox() called with multiple threads in process gpu-process.
  cypress:server:cypress starting in mode smokeTest with options { _: [ '/root/.cache/Cypress/13.6.0/Cypress/Cypress' ], sandbox: false, smokeTest: true, ping: 626, headless: true, 'disable-gpu': true, invokedFromCli: false, cwd: '/', config: {}, pong: 626, headed: false } +115ms
It looks like you are running the Cypress binary directly.

This is not the recommended approach, and Cypress may not work correctly.

Please install the cypress NPM package and follow the instructions here:

https://on.cypress.io/installing-cypress
  cypress:server:cypress running Electron currently +9ms
626
  cypress:server:cypress about to exit with code 0 +19ms
  cypress:server:browsers browsers.kill called with no active instance +0ms

Other

No response

jennifer-shehane commented 7 months ago

Yah I don't understand why this should be showing either. Is this specific to 13.6.0?

annamiaz commented 6 months ago

Hi @jennifer-shehane, for the setup mentioned by @kriehzoo the last working version is cypress@12.17.1 Newer versions (>12.17.1) seem to produce the problem mentioned above.