cypress
cypress copied to clipboard
Latest Docker image not compatible with ESM, failing with "configFile is invalid ... Unexpected identifier 'assert'"
Current behavior
Since yesterday I was getting this error despite not having updated anything in my code:
Your configFile is invalid: /opt/atlassian/pipelines/agent/build/apps/app-e2e/configs/cypress.config.dev.ts
It threw an error when required, check the stack trace below:
SyntaxError: Unexpected identifier 'assert'
at compileSourceTextModule (node:internal/modules/esm/utils:337:16)
at ModuleLoader.moduleStrategy (node:internal/modules/esm/translators:166:18)
at callTranslator (node:internal/modules/esm/loader:416:14)
at ModuleLoader.moduleProvider (node:internal/modules/esm/loader:422:30)
app-e2e
package in my npm monorepo is using ESM and ESM might have problems importing jsons, eg
import foo from './foo.json' assert { type: 'json' };
however, in our own code there were no such imports. I have pinned the version used in bitbucket pipelines to the previous one:
image: cypress/browsers:node-20.12.2-chrome-124.0.6367.60-1-ff-125.0.2-edge-124.0.2478.51-1
and it did the trick. Please fix your docker images and make them ESM compatible again.
Desired behavior
No response
Test code to reproduce
package.json:
"type": "module",
"scripts": {
"cypress:run": "cypress run --e2e --config-file=configs/cypress.config.dev.ts"
}
Cypress Version
cypress-13.6.6.tgz
Node version
20.11.0
Operating System
linux, specifics you should know better whatever is used in cypress/browser docker image
Debug Logs
No response
Other
No response
@philly-vanilly What was the docker-image you were using that was causing the issue?
@philly-vanilly What was the docker-image you were using that was causing the issue?
http://docker.io/cypress/browsers@sha256:44efcf6a4caba0a565a9677aa2ed2f98b24c33f25132792f56e47a3c5751563d
@philly-vanilly This link 404s for me. Can you point to the tag? https://hub.docker.com/r/cypress/browsers/tags
I have exactly the same problem with node:latest sha256:cbd62dc7ba7e50d01520f2c0a8d9853ec872187fa806ed61d0f87081c220386d
Same for me with node:latest sha256:64c46a664eccedec63941dab4027c178a36debe08a232d4f9d7da5aca91cff3d
I set it to node:21 and CI has run OK.