Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Uncaught SyntaxError: await is only valid in async functions, async generators and modules #30

Open
nmlen opened this issue Jan 30, 2024 · 6 comments · May be fixed by #34
Open

Uncaught SyntaxError: await is only valid in async functions, async generators and modules #30

nmlen opened this issue Jan 30, 2024 · 6 comments · May be fixed by #34

Comments

@nmlen
Copy link

nmlen commented Jan 30, 2024

(Firefox)

image

@fschlegelone
Copy link

Have the same problem. Also on Firefox

Uncaught SyntaxError: await is only valid in async functions, async generators and modules

But additionally there are hundreds of warnings saying fetch failed:

Source map error: NetworkError when attempting to fetch resource. Resource URL: https://abs.twimg.com/responsive-web/client-web/shared~loader.DMDrawer~bundle.ReaderMode~bundle.DirectMessages~bundle.DMRichTextCompose~bundle.TweetMediaDeta.26b9201a.js Source Map URL: https://ton.local.twitter.com/responsive-web-internal/sourcemaps/client-web/shared~loader.DMDrawer~bundle.ReaderMode~bundle.DirectMessages~bundle.DMRichTextCompose~bundle.TweetMediaDeta.26b9201a.js.map

OS: MacOS
CPU: ARM64 / aarch64
Browser: Firefox-Developer-Edition

@razrunelord
Copy link

Same error as well but am running via Node.js

@schdie
Copy link

schdie commented Mar 17, 2024

In order for this to work on firefox besides wrapping it on an async function like @azrogers points out is necessary to replace navigator.userAgentData (which it's not supported) with something like navigator.userAgent but for those who just want to run the script you can replace the line that starts with var ua = with:
var ua = "Mozilla/5.0 (X11; Linux x86_64; rv:121.1) Gecko/20100101 Firefox/121.1"; or whatever user-agent your browser has.

@UsernamesLame
Copy link

In order for this to work on firefox besides wrapping it on an async function like @azrogers points out is necessary to replace navigator.userAgentData (which it's not supported) with something like navigator.userAgent but for those who just want to run the script you can replace the line that starts with var ua = with: var ua = "Mozilla/5.0 (X11; Linux x86_64; rv:121.1) Gecko/20100101 Firefox/121.1"; or whatever user-agent your browser has.

Unfortunately this doesn't fix it in FireFox 123.0.1 x64 Windows 10

@schdie
Copy link

schdie commented Mar 18, 2024

In order for this to work on firefox besides wrapping it on an async function like @azrogers points out is necessary to replace navigator.userAgentData (which it's not supported) with something like navigator.userAgent but for those who just want to run the script you can replace the line that starts with var ua = with: var ua = "Mozilla/5.0 (X11; Linux x86_64; rv:121.1) Gecko/20100101 Firefox/121.1"; or whatever user-agent your browser has.

Unfortunately this doesn't fix it in FireFox 123.0.1 x64 Windows 10

Are you sure the problem is the user-agent string? Try changing the same line to: var ua = navigator.userAgent; it should work.

@LoLei
Copy link

LoLei commented May 1, 2024

For me it worked using an IIFE, see here.

(async function main () {
    // Paste the entire code here
})();

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
6 participants