Skip to content
This repository was archived by the owner on Sep 20, 2024. It is now read-only.
This repository was archived by the owner on Sep 20, 2024. It is now read-only.

Failed to execute 'atob' on 'Window' #92

@apalangi

Description

@apalangi

Hi! I'm getting the following error on my console that's preventing me from enabling the push notifications:
main.js:37 Uncaught DOMException: Failed to execute 'atob' on 'Window': The string to be decoded is not correctly encoded.
at urlB64ToUint8Array (http://127.0.0.1:8887/scripts/main.js:37:26)
at subscribeUser (http://127.0.0.1:8887/scripts/main.js:116:32)
at HTMLButtonElement. (http://127.0.0.1:8887/scripts/main.js:69:7)
urlB64ToUint8Array @ main.js:37

It's the line const rawData = window.atob(base64);
that's in the function provided in main.js
function urlB64ToUint8Array(base64String) {
const padding = '='.repeat((4 - base64String.length % 4) % 4);
const base64 = (base64String + padding)
.replace(/-/g, '+')
.replace(/_/g, '/');

const rawData = window.atob(base64);
const outputArray = new Uint8Array(rawData.length);

for (let i = 0; i < rawData.length; ++i) {
outputArray[i] = rawData.charCodeAt(i);
}
return outputArray;
}

I am new to this and have no clue what is going on. Any help/clarification would be GREATLY appreciated. Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions