cypress: Cypress tests fail in air-gapped network on Firefox

Current behavior

In an air gapped network, running a component or e2e tests using cypress on Firefox using the cypress/included docker image fails with the following error:

Cypress failed to make a connection to Firefox.

This usually indicates there was a problem opening the Firefox browser.

FetchError: request to https://raw.githubusercontent.com/mozilla/geckodriver/release/Cargo.toml failed, reason: read ECONNRESET
    at ClientRequest.<anonymous> (file:///root/.cache/Cypress/14.0.2/Cypress/resources/app/packages/server/node_modules/node-fetch/src/index.js:108:11)
    at ClientRequest.emit (node:events:518:28)
    at emitErrorEvent (node:_http_client:101:11)
    at TLSSocket.socketErrorListener (node:_http_client:504:5)
    at TLSSocket.emit (node:events:518:28)
    at emitErrorNT (node:internal/streams/destroy:169:8)
    at emitErrorCloseNT (node:internal/streams/destroy:128:3)
    at process.processTicksAndRejections (node:internal/process/task_queues:82:21)

This is likely a regression introduced in release 13.15.1 which started using geckodriver.

Desired behavior

I expect the test to run in an air gapped network. It should not send any request to the internet.

Test code to reproduce

Any test in Firefox in an air-gapped network.

Cypress Version

14.0.2

Node version

v22.13.1

Operating System

Debian bookworm

Debug Logs


Other

I also attempted to override the environment variables supported by geckodriver to use a local path

GECKODRIVER_VERSION = '0.35.0'
GECKODRIVER_CDNURL = 'file:///path/to/geckodriver/'

But it failed node-fetch does not support file:.

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 16 (15 by maintainers)

Most upvoted comments

@AtofStryker

I repeated my tests and found that the issue is also reproducible without using a Cypress Docker image, so any fix would be better placed directly in Cypress rather than in a Cypress Docker image.

@MikeMcC399 I don’t know how feasible this would be because we would need to ship every OS specific version of the driver with each OS specific version of the binary for a not very common use case. I’m suggesting we ship it in the docker container to at least mitigate the inconvenience of downloading the driver for the most likely use case of having an offline system.

The tests should still run offline, assuming geckodriver is already downloaded on the machine running the tests.

I see that would be complicated to do for Cypress in general. Let me open a new issue in the Cypress Docker repo and describe the issue testing Firefox ESR offline (available for amd64 and arm64). If a fix goes into the Docker images it would only need to be for Debian.

This issue should be closed, as it is resolved.

See previous https://github.com/cypress-io/cypress/issues/31036#issuecomment-2952514102 ⏫

The issue is reproducible with cypress/included and cypress/browsers Docker images. Edit: It does not appear to be an issue in native Ubuntu or Windows environments.

Steps to reproduce

git clone https://github.com/cypress-io/cypress-docker-images
cd cypress-docker-images
cd examples/basic-mini
docker run -it --rm -v .:/app -w /app --entrypoint cypress cypress/included:14.0.2 run -b firefox

OR

cd examples/basic
npm install cypress@14.0.2
docker build . -f Dockerfile.browsers -t test-browsers
docker run -it --rm --entrypoint bash test-browsers -c "npx cypress run -b firefox"
  • Run first with network connection
  • Repeat final docker run with disconnected network
Cypress:        14.0.2
Browser:        Firefox 135 (headless)
Node Version:   v22.13.1 (/usr/local/bin/node)