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

[BUG] Uncaught ReferenceError: process is not defined in REACT #307

Closed
7 of 8 tasks
elenitaex5 opened this issue Feb 1, 2023 · 1 comment
Closed
7 of 8 tasks
Labels
bug Something isn't working

Comments

@elenitaex5
Copy link

elenitaex5 commented Feb 1, 2023

Hi, I'm experimenting this issue in my React project. There's something similar in ANGULAR and an issue related with that. But their solution doesn't work in React.

My package.json has this package versions

"webpack": "5.75.0",
"webpack-cli": "^3.3.12",
 "webpack-dev-server": "^3.11.0",
 "twilio-client": "^1.14.0",

and my envs are wellformed. In my webpack.config.json dotenv is right initialized.
Including console.log('env', process.env) with my env vars inside webpack.config.json my env vars are filled and custom env right setted. Console are showing a list of env vars,
but this code inside node_modules/util/utils.js is breaking my app and is twilio-voice fault:

if (process.env.NODE_DEBUG) {
  var debugEnv = process.env.NODE_DEBUG;
  debugEnv = debugEnv.replace(/[|\\{}()[\]^$+?.]/g, '\\$&')
    .replace(/\*/g, '.*')
    .replace(/,/g, '$|^')
    .toUpperCase();
  debugEnvRegex = new RegExp('^' + debugEnv + '$', 'i');
}

First if is breaking my app. I think the problem is same as people are experimenting in Angular, but I don't know how can we solve it in React.

  • I have verified that the issue occurs with the latest twilio.js release and is not marked as a known issue in the CHANGELOG.md.
  • I reviewed the Common Issues and open GitHub issues and verified that this report represents a potentially new issue.
  • I verified that the Quickstart application works in my environment.
  • I am not sharing any Personally Identifiable Information (PII)
    or sensitive account information (API keys, credentials, etc.) when reporting this issue.

Code to reproduce the issue:

Only install it in React project having dependencies included above.
Starting the server with npm run serve and go to localhost:8080 is showing the error.

Expected behavior:

No errors initializing the app.

Actual behavior:

image

This error appears initializing the web.

Software versions:

  • Browser(s): Every browser
  • Operating System: MacOS
  • twilio.js:
  • Third-party libraries (e.g., Angular, React, etc.): REACT
@elenitaex5 elenitaex5 added the bug Something isn't working label Feb 1, 2023
@elenitaex5
Copy link
Author

elenitaex5 commented Feb 1, 2023

Problem is caused by util library dependency. It crushes with WEBPACK 5

I've found the real solution.
Real solution is here browserify/node-util#57 (comment)

And no file has to be changed except webpack.config.js once

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant