question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

InvalidCharacterError Failed to execute 'atob' on 'Window'

See original GitHub issue

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)

Issue Analytics

  • State:open
  • Created 3 years ago
  • Reactions:2
  • Comments:21 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
andreieftimiecommented, Feb 19, 2021

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:

InvalidCharacterError: Failed to execute 'atob' on 'Window': The string to be decoded is not correctly encoded.
SyntaxError: The following error originated from your test code, not from Cypress.
> Unexpected end of input
SyntaxError: The following error originated from your test code, not from Cypress.
> Invalid or unexpected token

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.route calls.

I am looking into issues relating to:

  • resource constrains — since we are running multiple processes in parallel, the machine might not have enough resources to allow the test run to complete correctly
  • resource locking — maybe one of the processes breaks one of the others that is running on the same machine
0reactions
kavehsaketcommented, Nov 12, 2022

I get the same error when I run my tests on GitHub actions. Cypress on ci is painful.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Failed to execute 'atob' on 'Window' - Stack Overflow
Here I got the error: Failed to execute 'atob' on 'Window': The string to be decoded is not correctly encoded. Because you didn't...
Read more >
HTML : Error:Failed to execute 'atob' on 'Window' - YouTube
HTML : Error: Failed to execute ' atob' on 'Window ': The string to be decoded is not correctly encoded [ Gift :...
Read more >
failed to execute 'atob' on 'window': the string to be decoded is ...
error domexception: failed to execute 'atob' on 'window': the string to be decoded is not correctly encoded. Add Answer | View In TPC...
Read more >
cypress-io/cypress - Gitter
I'm getting "InvalidCharacterError: Failed to execute 'atob' on 'Window': The string to be decoded is not correctly encoded.".
Read more >
Window atob() Method - W3Schools
Well organized and easy to understand Web building tutorials with lots of examples of how to use HTML, CSS, JavaScript, SQL, Python, PHP,...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found