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 failed to verify that your server is running." on Linux with latest Cypress #28338

Closed
alex1701c opened this issue Nov 15, 2023 · 3 comments
Labels
type: duplicate This issue or pull request already exists

Comments

@alex1701c
Copy link

Current behavior

I get the error "Cypress failed to verify that your server is running." on the console with component tests. I am using vite with react. The URL is http://localhost:5173.

After lots of trial and error, I came up with the following workaround in the cypress config:

export default defineConfig({
...
    env: {
...
    },
    hosts: { localhost: '127.0.0.1' },

This made it work on a RHEL8.8 server and on GithubActions based on UBI8 running in OpenShift. I am quite confused by this issue, especially because it work fine on my windows dev PC.

In any case I hope people having similar issues don't have to spend as much time debugging this as I did :D

Desired behavior

No response

Test code to reproduce

Launching normal component tests, test content doesn't matter.

Cypress Version

13.5.0

Node version

18

Operating System

RHEL 8.8

Debug Logs

2023-11-15T09:11:15.067Z cypress:cli parsed cli options { browser: 'electron', component: true }
2023-11-15T09:11:15.067Z cypress:cli verifying Cypress app
2023-11-15T09:11:15.068Z cypress:cli checking environment variables
2023-11-15T09:11:15.070Z cypress:cli checking if executable exists /home/user/.cache/Cypress/13.5.1/Cypress/Cypress
2023-11-15T09:11:15.085Z cypress:cli Binary is executable? : true
2023-11-15T09:11:15.086Z cypress:cli binaryDir is  /home/user/.cache/Cypress/13.5.1/Cypress
2023-11-15T09:11:15.086Z cypress:cli Reading binary package.json from: /home/user/.cache/Cypress/13.5.1/Cypress/resources/app/package.json
2023-11-15T09:11:15.089Z cypress:cli Found binary version 13.5.1 installed in: /home/user/.cache/Cypress/13.5.1/Cypress
2023-11-15T09:11:15.090Z cypress:cli { verified: true }
2023-11-15T09:11:15.090Z cypress:cli is Verified ? true
2023-11-15T09:11:15.090Z cypress:cli:run processing run options { browser: 'electron', component: true, key: null, spec: null, reporter: null, reporterOptions: null, project: '/home/user/framework/tk.sys.gui.client.web' }
2023-11-15T09:11:15.090Z cypress:cli:run --key is not set, looking up environment variable CYPRESS_RECORD_KEY
2023-11-15T09:11:15.090Z cypress:cli:run run to spawn.start args ["--run-project","/home/user/framework/tk.sys.gui.client.web","--browser","electron","--testing-type","component"]
2023-11-15T09:11:15.091Z cypress:cli undefined DISPLAY environment variable
2023-11-15T09:11:15.091Z cypress:cli Cypress will spawn its own Xvfb
2023-11-15T09:11:15.091Z cypress:cli needs to start own Xvfb? true
2023-11-15T09:11:15.091Z cypress:cli Starting Xvfb
2023-11-15T09:11:15.104Z cypress:xvfb _XSERVTransmkdir: Owner of /tmp/.X11-unix should be set to root


2023-11-15T09:11:28.755Z cypress:server:ensure-url checking that baseUrl is available {
  baseUrl: 'http://localhost:5173',
  delaysRemaining: [],
  retryIntervals: [ 3000, 3000, 4000 ]
}
2023-11-15T09:11:28.756Z cypress:network:agent addRequest called { isHttps: false, href: 'http://localhost:5173/' }
2023-11-15T09:11:28.756Z cypress:network:agent got family { family: undefined, href: 'http://localhost:5173/' }
2023-11-15T09:11:28.758Z cypress:server:server-base RequestError: Error: connect ECONNREFUSED ::1:5173
    at new r (<embedded>:1832:361393)
    at ee.callback (<embedded>:1832:367394)
    at e.callback.s.callback [as _callback] (<embedded>:1832:366840)
    at s._callback.s.callback.s.callback (<embedded>:2050:91633)
    at ee.emit (node:events:513:28)
    at ee.onRequestError (<embedded>:2050:100575)
    at ClientRequest.emit (node:events:513:28)
    at Socket.socketErrorListener (node:_http_client:502:9)
    at Socket.emit (node:events:513:28)
    at emitErrorNT (node:internal/streams/destroy:151:8)
    at emitErrorCloseNT (node:internal/streams/destroy:116:3)
    at process.processTicksAndRejections (node:internal/process/task_queues:82:21)
2023-11-15T09:11:28.760Z cypress:network:cors Parsed URL { port: '5173', protocol: 'http:', subdomain: null, domain: '', tld: 'localhost' }
2023-11-15T09:11:28.761Z cypress:network:cors Parsed URL { port: '5173', protocol: 'http:', subdomain: null, domain: '', tld: 'localhost' }
2023-11-15T09:11:28.761Z cypress:server:remote-states setting remote state { auth: undefined, origin: 'http://localhost:5173', strategy: 'http', fileServer: null, domainName: 'localhost', props: { port: '5173', protocol: 'http:', subdomain: null, domain: '', tld: 'localhost' } } for http://localhost:5173
2023-11-15T09:11:28.761Z cypress:network:cors Parsed URL { port: '5173', protocol: 'http:', subdomain: null, domain: '', tld: 'localhost' }
2023-11-15T09:11:28.761Z cypress:server:remote-states getting remote state: { auth: undefined, origin: 'http://localhost:5173', strategy: 'http', fileServer: null, domainName: 'localhost', props: { port: '5173', protocol: 'http:', subdomain: null, domain: '', tld: 'localhost' } } for: http://localhost:5173
2023-11-15T09:11:28.762Z cypress:server:cypress exiting with err Error
    at <embedded>:4526:8927
    at tryCatcher (/home/user/.cache/Cypress/13.5.1/Cypress/resources/app/node_modules/bluebird/js/release/util.js:16:23)
    at Promise._settlePromiseFromHandler (/home/user/.cache/Cypress/13.5.1/Cypress/resources/app/node_modules/bluebird/js/release/promise.js:512:31)
    at Promise._settlePromise (/home/user/.cache/Cypress/13.5.1/Cypress/resources/app/node_modules/bluebird/js/release/promise.js:569:18)
    at Promise._settlePromise0 (/home/user/.cache/Cypress/13.5.1/Cypress/resources/app/node_modules/bluebird/js/release/promise.js:614:10)
    at Promise._settlePromises (/home/user/.cache/Cypress/13.5.1/Cypress/resources/app/node_modules/bluebird/js/release/promise.js:690:18)
    at _drainQueueStep (/home/user/.cache/Cypress/13.5.1/Cypress/resources/app/node_modules/bluebird/js/release/async.js:138:12)
    at _drainQueue (/home/user/.cache/Cypress/13.5.1/Cypress/resources/app/node_modules/bluebird/js/release/async.js:131:9)
    at Async._drainQueues (/home/user/.cache/Cypress/13.5.1/Cypress/resources/app/node_modules/bluebird/js/release/async.js:147:5)
    at Immediate._onImmediate (/home/user/.cache/Cypress/13.5.1/Cypress/resources/app/node_modules/bluebird/js/release/async.js:17:14)
    at process.processImmediate (node:internal/timers:476:21) {
  isCypressErr: true,
  type: 'CANNOT_CONNECT_BASE_URL',
  details: undefined,
  messageMarkdown: 'Cypress failed to verify that your server is running.\n' +
    '\n' +
    'Please start this server and then run Cypress again.',
  originalError: undefined,
  stackWithoutMessage: '    at <embedded>:4526:8927\n' +
    '    at tryCatcher (/home/user/.cache/Cypress/13.5.1/Cypress/resources/app/node_modules/bluebird/js/release/util.js:16:23)\n' +
    '    at Promise._settlePromiseFromHandler (/home/user/.cache/Cypress/13.5.1/Cypress/resources/app/node_modules/bluebird/js/release/promise.js:512:31)\n' +
    '    at Promise._settlePromise (/home/user/.cache/Cypress/13.5.1/Cypress/resources/app/node_modules/bluebird/js/release/promise.js:569:18)\n' +
    '    at Promise._settlePromise0 (/home/user/.cache/Cypress/13.5.1/Cypress/resources/app/node_modules/bluebird/js/release/promise.js:614:10)\n' +
    '    at Promise._settlePromises (/home/user/.cache/Cypress/13.5.1/Cypress/resources/app/node_modules/bluebird/js/release/promise.js:690:18)\n' +
    '    at _drainQueueStep (/home/user/.cache/Cypress/13.5.1/Cypress/resources/app/node_modules/bluebird/js/release/async.js:138:12)\n' +
    '    at _drainQueue (/home/user/.cache/Cypress/13.5.1/Cypress/resources/app/node_modules/bluebird/js/release/async.js:131:9)\n' +
    '    at Async._drainQueues (/home/user/.cache/Cypress/13.5.1/Cypress/resources/app/node_modules/bluebird/js/release/async.js:147:5)\n' +
    '    at Immediate._onImmediate (/home/user/.cache/Cypress/13.5.1/Cypress/resources/app/node_modules/bluebird/js/release/async.js:17:14)\n' +
    '    at process.processImmediate (node:internal/timers:476:21)'
}
Cypress failed to verify that your server is running.

Please start this server and then run Cypress again.
2023-11-15T09:11:28.762Z cypress:server:cypress calling exit 1
2023-11-15T09:11:28.762Z cypress:server:cypress about to exit with code 1
2023-11-15T09:11:28.764Z cypress:server:browsers browsers.kill called with no active instance
2023-11-15T09:11:28.764Z cypress:proxy:http:util:prerequests metrics: { browserPreRequestsReceived: 0, proxyRequestsReceived: 0, immediatelyMatchedRequests: 0, unmatchedRequests: 0, unmatchedPreRequests: 0 }
2023-11-15T09:11:28.851Z cypress:cli child event fired { event: 'exit', code: 1, signal: null }
2023-11-15T09:11:28.852Z cypress:cli Stopping Xvfb
2023-11-15T09:11:28.862Z cypress:cli child event fired { event: 'close', code: 1, signal: null }

Other

No response

@jimmux
Copy link

jimmux commented Nov 24, 2023

Thanks for the workaround. This issue appeared for me when updating from Cypress 13.1 > 13.2. Using vue with webpack.

Cypress now reports "[webpack-dev-middleware] wait until bundle finished:" before attempting to reach a dev server. No retry attempts necessary.

@aeoncl
Copy link

aeoncl commented Jan 25, 2024

Can confirm we are also having this issue using Cypress v13.6.3 with an Angular project.
We run our ci test suite using the cypress/schematic v2.5.1 inside the docker image cypress/included:13.6.3

Then we get: Cypress failed to verify that your server is running

When mapping localhost to the loopback in Cypress config, the issue is worked around.

@jennifer-shehane
Copy link
Member

Duplicate of #27990

@jennifer-shehane jennifer-shehane marked this as a duplicate of #27990 Jan 25, 2024
@jennifer-shehane jennifer-shehane closed this as not planned Won't fix, can't repro, duplicate, stale Jan 25, 2024
@jennifer-shehane jennifer-shehane added type: duplicate This issue or pull request already exists and removed CT Issue related to component testing labels Jan 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: duplicate This issue or pull request already exists
Projects
None yet
Development

No branches or pull requests

4 participants