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

ReferenceError: TextEncoder is not defined #1622

Open
etorres07 opened this issue Nov 25, 2022 · 2 comments
Open

ReferenceError: TextEncoder is not defined #1622

etorres07 opened this issue Nov 25, 2022 · 2 comments

Comments

@etorres07
Copy link

What version were you using?

https://github.com/LearningLocker/learninglocker/releases/tag/v7.1.1

What steps can we follow to reproduce the behaviour?

Basically the steps in https://learninglocker.atlassian.net/wiki/spaces/DOCS/pages/622596/Installing (documentation update of Aug 04, 2022).

More specifically...

Using Ubuntu 18.04.6 LTS:

  1. curl -o- -L https://raw.githubusercontent.com/LearningLocker/deploy/master/deployll.sh > deployll.sh && bash deployll.sh
  2. sudo su learninglocker
  3. pm2 status displays that xAPI "errored" (see screenshot below of output table)
  4. pm2 logs xAPI include the following error for both 4|xAPI and 5|xAPI repeated times (e.g. even logging pm2 logs --lines 4000)
5|xAPI     | ReferenceError: TextEncoder is not defined
5|xAPI     |     at Object.<anonymous> (/usr/local/learninglocker/releases/ll-20221124-5fec948a823e372e740df521aa3684c8df1dcba7/xapi/node_modules/mongodb-connection-string-url/node_modules/whatwg-url/lib/encoding.js:2:21)
5|xAPI     |     at Module._compile (internal/modules/cjs/loader.js:778:30)
5|xAPI     |     at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
5|xAPI     |     at Module.load (internal/modules/cjs/loader.js:653:32)
5|xAPI     |     at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
5|xAPI     |     at Function.Module._load (internal/modules/cjs/loader.js:585:3)
5|xAPI     |     at Module.require (internal/modules/cjs/loader.js:692:17)
5|xAPI     |     at Module.Hook._require.Module.require (/usr/lib/node_modules/pm2/node_modules/require-in-the-middle/index.js:101:39)
5|xAPI     |     at require (internal/modules/cjs/helpers.js:25:18)
5|xAPI     |     at Object.<anonymous> (/usr/local/learninglocker/releases/ll-20221124-5fec948a823e372e740df521aa3684c8df1dcba7/xapi/node_modules/mongodb-connection-string-url/node_modules/whatwg-url/lib/url-state-machine.js:5:34)
5|xAPI     | 2022-11-25 10:07:48:095 - error: Failed Mongo connection: no primary found in replicaset or invalid replica set name
5|xAPI     | 2022-11-25 10:07:48:098 - error: Failed initial mongo connection: Too many retries

What is the actual behaviour?

Screenshot from 2022-11-25 10-45-36

What is the expected behavior?

The expected behavior is for all processes to start with an "online" status.

Is there any additional information that will help us replicate/understand the problem?

I did some digging and it seems to be related with node's version:
jsdom/whatwg-url#209
Automattic/mongoose#10638

The only thing that fixed it for me was:

  1. Following this suggestion https://stackoverflow.com/a/69287561/20588311
  2. Changing from the installed node version (10.24.1; i.e. the one that learning-locker installed during deployll.sh execution) to node 16.8.1.
  3. Running yarn
@thiagoocortes
Copy link

It helped me:

https://www.youtube.com/watch?v=EJF_U6wIh8M

@jybleau
Copy link

jybleau commented Feb 8, 2023

There is a solution in this issue #1625
Adding a "missing" require.

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

No branches or pull requests

3 participants