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.

ReferenceError: TextEncoder is not defined

See original GitHub issue

image

image

Hi, I used the createScript method to create the script, while it throws the exception with the information of ReferenceError: TextEncoder is not defined.
I use the neon-js-5.0.0-next.7 version which I expect for neo rc1.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:15 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
snowypowerscommented, Apr 26, 2021

Hi I root caused the problem to be an issue with jest and the environment. You are using jest with the default testEnvironment which is jsdom. There is a bug with jsdom where TextEncoder is not available within the global namespace.

neon-js runs tests with the node environment thus we did not encounter such an issue.

To fix this, you either use a node test environment or amend your global environment with the correct globals.

0reactions
bettybao1209commented, Apr 27, 2021

To fix this, you either use a node test environment or amend your global environment with the correct globals.

Yes, by specifying --env=node it seems to fix the TextEncoder issue.

Read more comments on GitHub >

github_iconTop Results From Across the Web

ReferenceError: TextEncoder is not defined - Stack Overflow
This issue occurs in node 10 or lower version only. To resolve this issue upgrade node version to 12 or higher and then...
Read more >
TextEncoder is not defined #209 - jsdom/whatwg-url - GitHub
You need to provide an example that only uses whatwg-url, no other packages, that we can run with node test.js . 👎 34...
Read more >
Node.js TextEncoder - GeeksforGeeks
The TextEncoder class does not inherit any property. Only one property is defined which is: TextEncoder.prototype.encoding: It is a read-only ...
Read more >
TextEncoder is not defined Node.js with mongoose-mongodb
[Solved]-ReferenceError: TextEncoder is not defined Node.js with mongoose-mongodb. Search. score:29. Accepted answer. Actually mongoose 6 requires Node 12 ...
Read more >
Ember Builds Fail for All Ember 3.22+ apps - Support
12:49:53 AM: - originalErrorMessage: [undefined] 12:49:53 AM: - stack: ReferenceError: TextEncoder is not defined 12:49:53 AM: at Object.
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