cypress: InvalidCharacterError Failed to execute 'atob' on 'Window'
Current behavior
We are getting the following error trace. This is occurring randomly on random spec files in our CI environment. We are not able to reproduce it. All the retries also fail with the same error.
InvalidCharacterError: The following error originated from your test code, not from Cypress.
> Failed to execute 'atob' on 'Window': The string to be decoded is not correctly encoded.
When Cypress detects uncaught errors originating from your test code it will automatically fail the current test.
Error: Failed to execute 'atob' on 'Window': The string to be decoded is not correctly encoded.
at Object.decodeBase64Unicode (https://example.com/__cypress/runner/cypress_runner.js:177637:31)
at base64toJs (https://example.com/__cypress/runner/cypress_runner.js:176928:28)
at Object.extractSourceMap (https://example.com/__cypress/runner/cypress_runner.js:176894:21)
at extractSourceMap (https://example.com/__cypress/runner/cypress_runner.js:175985:37)
at tryCatcher (https://example.com/__cypress/runner/cypress_runner.js:10325:23)
at MappingPromiseArray._promiseFulfilled (https://example.com/__cypress/runner/cypress_runner.js:7445:38)
at MappingPromiseArray.PromiseArray._iterate (https://example.com/__cypress/runner/cypress_runner.js:8647:31)
at MappingPromiseArray.init (https://example.com/__cypress/runner/cypress_runner.js:8611:10)
at Promise._settlePromise (https://example.com/__cypress/runner/cypress_runner.js:8314:21)
at Promise._settlePromise0 (https://example.com/__cypress/runner/cypress_runner.js:8362:10)
at Promise._settlePromises (https://example.com/__cypress/runner/cypress_runner.js:8442:18)
at Promise._fulfill (https://example.com/__cypress/runner/cypress_runner.js:8386:18)
at MappingPromiseArray.PromiseArray._resolve (https://example.com/__cypress/runner/cypress_runner.js:8659:19)
at MappingPromiseArray._promiseFulfilled (https://example.com/__cypress/runner/cypress_runner.js:7485:18)
at Promise._settlePromise (https://example.com/__cypress/runner/cypress_runner.js:8322:26)
at Promise._settlePromise0 (https://example.com/__cypress/runner/cypress_runner.js:8362:10)
Desired behavior
The tests should not fail with this error or atleast should correct itself in retries.
Test code to reproduce
Unable to reproduce the error consistently.
Versions
Cypress: 5.3.0 Browser: Custom Chrome 86 (headless)
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Reactions: 3
- Comments: 26 (4 by maintainers)
We don’t recommended running more than 1 Cypress process in parallel on a single machine. There are a few issues that happen when this is done and the majority of the time, there is not enough resources on the machine to run Cypress and it still be performant.
Not right now – is this still an issue in later versions of Cypress (eg Cypress 12)?
It’s hard to assign someone to work on this when it’s so difficult to reproduce consistently - hard to debug and fix something that’s primarily a race condition, especially if it only occurs running many Cypress instances in on a single machine in parallel, which isn’t something we generally recommend (parallelization via CI and separate machines, however, is definitely something we use heavily).
You could try https://github.com/cypress-io/cypress/issues/9442#issuecomment-967204203. I don’t fully understand how the webpack preprocessor conflict occurs that is suggested in that article, nor how it would lead to the
atoberror.@andreieftimie Solution that helped me Fix unexpected token and win atob
I started seeing these and other (similar in nature) errors when switching to running more than 1 cypress test in parallel on the same machine.
The following failures are observed:
All of these are always visible on the first test of each chunk, which leads me to think that cypress or the browser are not properly initiated (or the app does not manage finishing loading) before the test attempts to start.
We are running cypress 5.3.0 — would really like to solve these before attempting to upgrade to the latest version since there’s a non-trivial amount of work to update of the
cy.routecalls.I am looking into issues relating to: