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

Update utils.js #2981

Merged
merged 1 commit into from
May 19, 2023
Merged

Update utils.js #2981

merged 1 commit into from
May 19, 2023

Conversation

sudarshanvn
Copy link
Contributor

Fixed following error

ReferenceError: TextEncoder is not defined

Fixed following error

    ReferenceError: TextEncoder is not defined
@sudarshanvn
Copy link
Contributor Author

Fixed the following error in Node.Js 16 version
ReferenceError: TextEncoder is not defined 

@brianc
Copy link
Owner

brianc commented May 19, 2023

oh nice fix thank you!!

@brianc brianc merged commit 522e2dc into brianc:master May 19, 2023
@sudarshanvn
Copy link
Contributor Author

When I can expect these changes to go live ??

@charmander
Copy link
Collaborator

in Node.Js 16 version

Are you sure? The Node documentation shows that TextEncoder and TextDecoder have been globals since version 11.0.0. On top of that, pg’s CI, which covers this, already passed on all supported versions.

charmander added a commit that referenced this pull request May 23, 2023
charmander added a commit that referenced this pull request May 23, 2023
@sudarshanvn
Copy link
Contributor Author

@charmander @brianc

I`m seeing this issue in NodeJs 16 and NodeJs 18 version

image

Debugger attached.
FAIL test/client-alert-task-get.spec.js
● Test suite failed to run

ReferenceError: TextEncoder is not defined

   6 | /* eslint-disable import/no-unresolved */
   7 | const ExceptionWrapper = require('exception-handler');
>  8 | const ReqParserFramework = require('medifast-framework').RequestParser;
     |                            ^
   9 | const commonMessage = require('./constants/common-messages');
  10 |
  11 | const exceptionHandler = new ExceptionWrapper();

  at Object.<anonymous> (../../../common/layer/medifast-framework/dependencies/nodejs/node_modules/medifast-framework/node_modules/pg/lib/crypto/utils.js:31:21)

@sudarshanvn
Copy link
Contributor Author

to fix this issue, I have added the following code in packages/pg/lib/crypto/utils.js file

const { TextEncoder, TextDecoder } = require('util');

@john-laird
Copy link

@sudarshanvn - we actually had the same issue, this comment solved the problem for us: https://stackoverflow.com/a/73454657

thijs pushed a commit to thijs/node-postgres that referenced this pull request Aug 1, 2023
Fixed following error

    ReferenceError: TextEncoder is not defined
thijs pushed a commit to thijs/node-postgres that referenced this pull request Aug 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants