cypress
cypress copied to clipboard
cypress run (v13.6.5 and v13.6.6) hangs on Docker (M2 Mac) using --platform=linux/amd64
Current behavior
Setup
- Docker Desktop on macOS Sonoma 14.4
- Emulating to platform linux/amd64 in order to use Chrome browser
- Attempted with Node v20 and v21
- Attempted with Electron and Chrome
- This works as expected when --platform=linux/amd64 is removed, but that limits the browser choice to just Electron
cypress run fails with 13.6.5 and 13.6.6
When using cypress version 13.6.5 and 13.6.6, executing cypress run fails as it just hangs right after announcing it is about to start the test.
DEBUG: cypress:* prints this before hanging:
cypress:server:run about to run spec {
"spec":{
"absolute":"/cypress/cypress/e2e/test.cy.ts",
"fileExtension":".ts",
"fileName":"test",
"name":"test.cy.ts",
"relative":"cypress/e2e/test.cy.ts"
},
"isHeadless":true,
"browser":{
"channel":"stable",
"displayName":"Electron",
"family":"chromium",
"majorVersion":118,
"name":"electron",
"path":"",
"version":"118.0.5993.159"
}
} +32ms
The entire debug output of DEBUG: cypress:*:error is:
cypress:snapshot:error TypeError [ERR_INVALID_ARG_TYPE]: The "paths[1]" argument must be of type string. Received undefined
cypress:snapshot:error at new NodeError (node:internal/errors:405:5)
cypress:snapshot:error at validateString (node:internal/validators:162:11)
cypress:snapshot:error at Object.resolve (node:path:1097:7)
cypress:snapshot:error at Object.resolve (evalmachine.<anonymous>:1:765400)
cypress:snapshot:error at resolvePathsAndParent (<embedded>:4511:1077511)
cypress:snapshot:error at customRequire (<embedded>:4511:1076567)
cypress:snapshot:error at c (<embedded>:2827:111097)
cypress:snapshot:error at <embedded>:2827:111632
cypress:snapshot:error at <embedded>:4511:18500
cypress:snapshot:error at FSReqCallback.readFileAfterClose [as oncomplete] (node:internal/fs/read_file_context:68:3) +0ms
cypress:snapshot:error TypeError [ERR_INVALID_ARG_TYPE]: The "paths[1]" argument must be of type string. Received undefined
cypress:snapshot:error at new NodeError (node:internal/errors:405:5)
cypress:snapshot:error at validateString (node:internal/validators:162:11)
cypress:snapshot:error at Object.resolve (node:path:1097:7)
cypress:snapshot:error at Object.resolve (evalmachine.<anonymous>:1:765400)
cypress:snapshot:error at resolvePathsAndParent (<embedded>:4511:1077539)
cypress:snapshot:error at customRequire (<embedded>:4511:1076567)
cypress:snapshot:error at c (<embedded>:2827:111097)
cypress:snapshot:error at <embedded>:2827:111632
cypress:snapshot:error at <embedded>:4511:18500
cypress:snapshot:error at FSReqCallback.readFileAfterClose [as oncomplete] (node:internal/fs/read_file_context:68:3) +1ms
And it hangs as follows:
cypress run succeeds with 13.6.4
When using cypress version 13.6.4 with the setup otherwise identical, the test completes as expected except it instead prints this message:
[754:0308/191324.311425:ERROR:object_proxy.cc(590)] Failed to call method: org.freedesktop.portal.Settings.Read: object_path= /org/freedesktop/portal/desktop: unknown error type:
Desired behavior
cypress run executes successfully with the latest version, without hanging, and without error messages.
Test code to reproduce
- Clone this repo: https://github.com/DI-Studios/cypress-in-docker-hangs-on-mac
- Start the container from the repo root with
docker compose run --interactive --build --rm cypress - Inside the container run
cypress run
Cypress Version
13.6.6
Node version
v20.11.0
Operating System
macOS 14.4
Debug Logs
See gist: https://gist.github.com/josh-distudios/5640d35efc0b542df0a78706e1ad6f9e
Other
I've had a look at the cypress:snapshot:error to see if I can work out where it's coming from, but it appears on 13.6.4 which runs successfully so I'm not sure it's related to this error.
I've also searched the logs for the term "error" which showed that playwright-webkit is missing, but when I installed this locally it didn't have resolve the issue.
I wasn't able to recreate this with the example on my Intel Mac. I'll have to get someone with an M1 to try it next.
Electron was updated in 13.6.5, so I would suspect that is the cause for this behavior.
Great - thanks!
Just adding - I'm also seeing this and can reproduce the issue from @josh-atkins github repo. I'm running an M1 Mac Sonoma 14.3.1.
This has been causing pain while dockerising our tests and I had no idea why!
Hey is there any solution, I have the same problem
I refer to this https://github.com/cypress-io/cypress-docker-images/blob/master/base/centos7/Dockerfile to build my image。 And I change nodejs to 16.x, it alwys hangs。 I also tried cypress/base, this works. I cannot use cypress/base in my company, I can only use centos to build images myself。 pc: Apply M2 Pro.
@mengfei0053 Our minimum supported version with recent versions of Cypress is Node 18+ https://docs.cypress.io/guides/getting-started/installing-cypress#Nodejs
@josh-atkins Are you utilizing Colima as the Docker container? I recently encountered the same issue and upon checking your demo repository, I found some information:
- When starting Colima with the
--vm-type=vzcommand, it hangs in the same way as your problem. - Using the
--vm-type=qemucommand, which is the default VM type for Lima, results in a "Failed to connect to the bus: Failed to connect to socket /run/dbus/system_bus_socket: No such file or directory" error in the Cypress verification step when Cypress runs. - When I switched to use
--arch x86_64 --vm-type=qemu, Cypress logs the error "The "paths[1]" argument must be of type string. Received undefined" but the test still runs successfully.
So, I think the problem might occur inside the Docker container(colima). Unfortunately, I don't have a Docker Desktop license, so I can't verify whether this problem also occurs on Docker Desktop.
Same issue here on M1 with MacOS 14.5, Cypress 13.6.4 works under Docker (this image) with --platform=linux/amd64 (using Rosetta 2) but later Cypress versions hang indefinitely.
This is a M(1 2 3) issue on macbooks... :/
My cypress tests works fine on a Lenovo and on our build server - but not on my Macook Pro M3 😦
Same issue on Mac OS 13.6 , processor M1
e2e-test | [SUCCESS] Verified Cypress! /root/.cache/Cypress/13.13.0/Cypress
e2e-test |
e2e-test | DevTools listening on ws://127.0.0.1:58611/devtools/browser/ff0bfa3a-3e9d-4a26-9ad6-aee0b7212352
e2e-test | Couldn't find tsconfig.json. tsconfig-paths will be skipped
it hangs.
I wasn't able to recreate this with the example on my Intel Mac. I'll have to get someone with an M1 to try it next.
Electron was updated in 13.6.5, so I would suspect that is the cause for this behavior.
@jennifer-shehane any updates on this? From my conversation with our Cypress TAM I understand that access to M1 and M2 architecture at Cypress is limited but we are severely impaired by this as our local environment doesn't match the tests in CI and produces inconsistent results.
Any updates on this? I'm getting the same issue on an M1 mac. No errors in the verbose logs, but it hangs indefinitely. My co-worker has an intel based mac and it works fine for him.
I got mine working - it turns out, for me, that the base docker image that we used was build on an amd64 CPU without arm64 capabilities.
I build the base image on my machine and then used that to build our Cypress docker image again. This time the tests started and everything worked as before.
So in our case it was the combo of an amd64 base image together with an arm64 docker image. It had to be arm64 all the way. Our base image is a custom build debian bookworm and our cypress docker image builds on that.
I am seeing this as well.
Mac M3, Mac OS Sonoma 14.5 Cypress 13.17.0
Using the cypress/included:13.17.0 docker image, hangs:
This is making it impossible to run our Cypress visual regression tests on any ARM-based Mac. And switching to Electron is not an option for us, as it has strange rendering differences that make our visual regression tests flaky and unreliable (as in, we'll run the tests in Electron on one machine, accept differences, then run them on another machine and get visual differences, which is exactly what running in a Docker image was supposed to fix).
Is there any effort being made to fix this?
The same problem troubles me.
OS: macOS 15.2, CPU: arm64 Apple M1 Pro Cypress: 13.17.0
Like everyone else, I cannot use electron to take screenshots for visual regression
I experienced this issue previously. With the latest version (4.42.0) of Docker Desktop, I no longer experience this problem.