Wa-automate-nodejs: proxy not working

Created on 23 Jul 2020  Β·  33Comments  Β·  Source: open-wa/wa-automate-nodejs

Describe the bug
A clear and concise description of what the bug is.

When i add the proxy option with username and password, its not get the proxy credentials.

  1. add the proxy option and it will not work
 const client = await create({
            autoRefresh:true, //default to true
            qrRefreshS:35,
            executablePath: process.platform === 'linux' ? "/usr/bin/google-chrome" : "/Applications/Google Chrome.app/Contents/MacOS/Google Chrome",
            headless: process.platform === 'linux' ? true : false,
            proxyServerCredentials:{
                address:this.server.proxy.ip+':'+this.server.proxy.port,
                username:this.server.proxy.username,
                password:this.server.proxy.password
            },
        });

The proxy should work

DEBUG INFO
This is the info printed to the console when you start your app. It should look like this

I do not know why but i do not get all these information, i just see colors, i added image
https://ibb.co/kgf1v5y

Screenshots
If applicable, add screenshots to help explain your problem. Use headless: false to get screenshots

Host (please complete the following information):

  • OS:

Additional context
Error:

foundNewVersion 0 this.version 5.9

- Initializing WA
Error: net::ERR_INVALID_AUTH_CREDENTIALS at https://web.whatsapp.com
    at navigate (/Users/roysabah/www/msgto/server/node_modules/puppeteer/lib/FrameManager.js:120:37)
    at process._tickCallback (internal/process/next_tick.js:68:7)
  -- ASYNC --
    at Frame.<anonymous> (/Users/roysabah/www/msgto/server/node_modules/puppeteer/lib/helper.js:111:15)
    at Page.goto (/Users/roysabah/www/msgto/server/node_modules/puppeteer/lib/Page.js:672:49)
    at Page.<anonymous> (/Users/roysabah/www/msgto/server/node_modules/puppeteer/lib/helper.js:112:23)
    at Object.<anonymous> (/Users/roysabah/www/msgto/server/node_modules/@open-wa/wa-automate/dist/controllers/browser.js:228:44)
    at step (/Users/roysabah/www/msgto/server/node_modules/@open-wa/wa-automate/dist/controllers/browser.js:63:23)
    at Object.next (/Users/roysabah/www/msgto/server/node_modules/@open-wa/wa-automate/dist/controllers/browser.js:44:53)
    at fulfilled (/Users/roysabah/www/msgto/server/node_modules/@open-wa/wa-automate/dist/controllers/browser.js:35:58)
    at process._tickCallback (internal/process/next_tick.js:68:7) 'Unhandled Rejection at Promise' Promise {
  <rejected> Error: net::ERR_INVALID_AUTH_CREDENTIALS at https://web.whatsapp.com
      at navigate (/Users/roysabah/www/msgto/server/node_modules/puppeteer/lib/FrameManager.js:120:37)
      at process._tickCallback (internal/process/next_tick.js:68:7)
    -- ASYNC --
      at Frame.<anonymous> (/Users/roysabah/www/msgto/server/node_modules/puppeteer/lib/helper.js:111:15)
      at Page.goto (/Users/roysabah/www/msgto/server/node_modules/puppeteer/lib/Page.js:672:49)
      at Page.<anonymous> (/Users/roysabah/www/msgto/server/node_modules/puppeteer/lib/helper.js:112:23)
      at Object.<anonymous> (/Users/roysabah/www/msgto/server/node_modules/@open-wa/wa-automate/dist/controllers/browser.js:228:44)
      at step (/Users/roysabah/www/msgto/server/node_modules/@open-wa/wa-automate/dist/controllers/browser.js:63:23)
      at Object.next (/Users/roysabah/www/msgto/server/node_modules/@open-wa/wa-automate/dist/controllers/browser.js:44:53)
      at fulfilled (/Users/roysabah/www/msgto/server/node_modules/@open-wa/wa-automate/dist/controllers/browser.js:35:58)
      at process._tickCallback (internal/process/next_tick.js:68:7) }

I also tried to check this proxy with pupetter and it works as expected

const browser = await puppeteer.launch({
        headless:false,
        args: ['--proxy-server=45.143.246.248:8000']
    });

    const page = await browser.newPage();
    await page.authenticate({
        username: 'p72khv',
        password: 'bBJ0A0'
    });
    await page.goto('https://example.com');
    await page.screenshot({path: 'example.png'});

(I know, i paste the code with the username and password of my proxy, i will change it when the bug will be solved)

bug

Most helpful comment

working!

All 33 comments

in צט package.json folder it show the latest version: 1.9.103

any update?

@roysG how often does this happen. This error shows that it's unable to connect to WhatsApp web this seems to be an issue with the proxy details

Hi,
As you can see I added the real info of the proxy.

I tested the same creditinals proxy with puppeteer with no provlem

You can test it also by yourself

On Fri, 24 Jul 2020, 20:28 Mohammed Shah notifications@github.com wrote:

@roysG https://github.com/roysG how often does this happen. This error
shows that it's unable to connect to WhatsApp web this seems to be an issue
with the proxy details

β€”
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/open-wa/wa-automate-nodejs/issues/670#issuecomment-663648351,
or unsubscribe
https://github.com/notifications/unsubscribe-auth/ABXZDOQGNAD4UPT4MSQ2QCDR5HAEXANCNFSM4PFOTL4Q
.

@github-actions run


⚑ Release! ⚑

(async () => {
function exec(cmd) {
  console.log(execSync(cmd).toString());
}

// Config
const gitUserEmail = "github-actions[bot]@users.noreply.github.com";
const gitUserName = "github-actions[bot]";

exec(`echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" > .npmrc`);
exec(`git config --global user.email "${gitUserEmail}"`);
exec(`git config --global user.name "${gitUserName}"`);
exec(`npm i`);
exec(`npm run release-ci`);

//comment on the issue
var result = execSync(`npx auto-changelog -o ./tempchangelog.txt --commit-limit false --template ./compact-keepachangelog.hbs --stdout`).toString();

    await postComment(result);

//create changelog image
exec(`npm run release-image`);
exec(`git commit -a -m 'updated release-image'`);
exec(`git push --force`);
  })();

Changelog

πŸš€ Release 1.9.104 (2020-07-25)

  • build(deps): bump p-queue from 6.5.0 to 6.6.0 #662
  • build(deps): bump @types/sharp from 0.25.0 to 0.25.1 #668
  • build(deps): bump puppeteer-extra-plugin-devtools from 2.2.11 to 2.2.12 #671
  • build(deps): bump puppeteer-extra-plugin-stealth from 2.4.13 to 2.4.14 #672
  • build(deps): bump puppeteer-extra from 3.1.12 to 3.1.13 #674
  • build(deps-dev): bump @types/node from 14.0.24 to 14.0.25 #673
  • build(deps): bump puppeteer from 5.1.0 to 5.2.1 #669
  • build(deps-dev): bump @types/node from 14.0.23 to 14.0.24 #666
  • Release 1.9.104 6c61663
  • fix: Proxies are now working #670 f306a04

@roysG should be working in latest version. Test it out and let me know thanks

I update to latest version, still not working, i get error:

- Initializing WA
TypeError: Cannot read property 'get' of undefined
    at removeRequestListener (/Users/roysabah/www/msgto/server/node_modules/puppeteer-page-proxy/src/core/proxy.js:48:38)
    at proxyPerPage (/Users/roysabah/www/msgto/server/node_modules/puppeteer-page-proxy/src/core/proxy.js:80:5)
    at process._tickCallback (internal/process/next_tick.js:68:7) 'Unhandled Rejection at Promise' Promise {
  <rejected> TypeError: Cannot read property 'get' of undefined
      at removeRequestListener (/Users/roysabah/www/msgto/server/node_modules/puppeteer-page-proxy/src/core/proxy.js:48:38)
      at proxyPerPage (/Users/roysabah/www/msgto/server/node_modules/puppeteer-page-proxy/src/core/proxy.js:80:5)
      at process._tickCallback (internal/process/next_tick.js:68:7) }

Wth I tested with your exact details. Can you clear node_modules then npm I and try again.

I tried to remove the node_modules and install it again, the problem is still happening with the same error.
On macbook pro Mojave version 10.14.4

P.S:
I canΧ³t copy the description of your WA... info cause i canΧ³t see it,
I just see a lot of colors

@roysG use disableSpins: true to stop seeing those colours. Can you ping me on discord please. Thanks

ok, and what about the proxy problem?

On Sat, Jul 25, 2020 at 10:01 PM Mohammed Shah notifications@github.com
wrote:

@roysG https://github.com/roysG use disableSpins: true for to stop
seeing those colours.

β€”
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/open-wa/wa-automate-nodejs/issues/670#issuecomment-663889411,
or unsubscribe
https://github.com/notifications/unsubscribe-auth/ABXZDOQKVXFSEE5YP3SW5BTR5MTYFANCNFSM4PFOTL4Q
.

working on it. I'm sure it's a puppeteer version problem

@roysG can you use 1.9.105, clear node_modules, reinstall dependencies, and make sure you're using node v12.18.3 or higher. I've tested with your provided proxy details and it is working.

I really do not know what to say to you, but the problem still exists
I update my nodejs to 12.18.3
i remove my node_modules folder (rm -rf node_modules)
i changed the version of the package to latest.
i reinstall it with npm install.
I also tried to close webstorm and reopen it.

this is the output:

Opening `/dev/tty` failed (6): Device not configured
resize:  can't open terminal /dev/tty
- Initializing WA
┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
┃                                                                                                   ┃
┃   @open-wa/wa-automate                                                                            ┃
┃    πŸ’¬ πŸ€– The most reliable NodeJS whatsapp library for chatbots with advanced features.           ┃
┃   Version: 1.9.105                                                                                ┃
┃   Check out the latest changes: https://github.com/open-wa/wa-automate-nodejs#latest-changes      ┃
┃                                                                                                   ┃
┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛

TypeError: Cannot read property 'get' of undefined
    at removeRequestListener (/Users/roysabah/www/msgto/server/node_modules/puppeteer-page-proxy/src/core/proxy.js:48:38)
    at proxyPerPage (/Users/roysabah/www/msgto/server/node_modules/puppeteer-page-proxy/src/core/proxy.js:80:5)
    at processTicksAndRejections (internal/process/task_queues.js:97:5)
    at async useProxy (/Users/roysabah/www/msgto/server/node_modules/puppeteer-page-proxy/src/core/proxy.js:94:9) Unhandled Rejection at Promise Promise {
  <rejected> TypeError: Cannot read property 'get' of undefined
      at removeRequestListener (/Users/roysabah/www/msgto/server/node_modules/puppeteer-page-proxy/src/core/proxy.js:48:38)
      at proxyPerPage (/Users/roysabah/www/msgto/server/node_modules/puppeteer-page-proxy/src/core/proxy.js:80:5)
      at processTicksAndRejections (internal/process/task_queues.js:97:5)
      at async useProxy (/Users/roysabah/www/msgto/server/node_modules/puppeteer-page-proxy/src/core/proxy.js:94:9)
}
--- 1 error in server, restart pm2 ---
stderr: Debugger listening on ws://127.0.0.1:59826/7d8e2a3a-d14d-45c9-9623-d1f44db00ee9
For help, see: https://nodejs.org/en/docs/inspector

stderr: Debugger attached.

stdout: Use --update-env to update environment variables

$ node -v
v12.18.3

Just for test,
i tried to test the proxy with old version (1.9.64) and the proxy working fine.

In the new version the description below is missing:

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚       (index)       β”‚                                                                    Values                                                                     β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚     WA_VERSION      β”‚                                                                  '2.2029.4'                                                                   β”‚
β”‚       PAGE_UA       β”‚ 'WhatsApp/2.2019.8 Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.138 Safari/537.36' β”‚
β”‚ WA_AUTOMATE_VERSION β”‚                                                                   '1.9.64'                                                                    β”‚
β”‚   BROWSER_VERSION   β”‚                                                             'Chrome/84.0.4147.89'                                                             β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

@roysG can you clone this repo and run the demo with your proxy details. DM me on discord

@roysG please share your app's package-lock.json from both environments

@roysG this is 100% happening because somehow your system is using a wrong version of puppeteer.

I check the package in your repository and mine and it was the same, I can
also copy yop some specific file if you want

Today during the day I will try to download the repository as zip file and
extract and check

On Mon, 27 Jul 2020, 11:31 Mohammed Shah notifications@github.com wrote:

@roysG https://github.com/roysG this is 100% happening because somehow
your system is using a wrong version of puppeteer.

β€”
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/open-wa/wa-automate-nodejs/issues/670#issuecomment-664200491,
or unsubscribe
https://github.com/notifications/unsubscribe-auth/ABXZDOVIWOWLAM6YG3TAZHLR5U3NNANCNFSM4PFOTL4Q
.

I tried to get the specific version from github:
npm install https://github.com/open-wa/wa-automate-nodejs.git

but i get error when i run it:
Error: Cannot find module '@open-wa/wa-automate'

@roysG you'll have to got clone. Can you attach your package lock please thanks

I canΧ³t understand how to install the npm from the git,
Please write me the steps and i will do it.

Anyway, this is my package.json:

{
"name": "api",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"dev": "nodemon --inspect=0.0.0.0:9229 app.js --env=development",
"qa": "nodemon --inspect=0.0.0.0:9229 app.js --env=qa",
"start": "node app.js --env=production"
},
"author": "",
"license": "ISC",
"dependencies": {
"base64-to-image": "^1.0.2",
"images-to-pdf": "^1.0.3",
"mongoose": "^5.9.11",
"needle": "^2.4.1",
"npm": "^6.14.4",
"public-ip": "^4.0.1",
"puppeteer": "^2.1.1",
"redis": "^2.8.0",
"request": "^2.88.2",
"url-to-image": "^1.0.0",
"wa-decrypt": "^1.0.4"
},
"devDependencies": {
"babel-core": "^6.25.0",
"babel-loader": "^7.1.1",
"babel-plugin-transform-runtime": "^6.23.0",
"babel-polyfill": "^6.23.0",
"babel-preset-env": "^1.6.0",
"webpack": "^3.3.0"
}
}

@roysG your package-lock.json file.

Also, please delete this line

"puppeteer": "^2.1.1",

Then delete node_modules folder.

Then install open-wa using:

npm i --save @open-wa/wa-automate

package-lock.json:
https://justpaste.it/4d1pg

I remove puppeter for package.json
delete the node_module
npm install

Now the error is gone but the proxy not take effect

This is the code:

this.server.proxy = {
ip:'45.143.246.248',
port:'8000',
username:'p72khv',
password:'bBJ0A0'
}

    console.log('this.server.proxy',this.server.proxy);


    const client = await create({
        autoRefresh:true, //default to true
        qrRefreshS:35,
        executablePath: process.platform === 'linux' ? "/usr/bin/google-chrome" : "/Applications/Google Chrome.app/Contents/MacOS/Google Chrome",
        headless: process.platform === 'linux' ? true : false,
        proxyServerCredentials:{
            address:this.server.proxy.ip+':'+this.server.proxy.port,
            username:this.server.proxy.username,
            password:this.server.proxy.password
        },
        disableSpins: true,
        sessionId:'session_'+this.ip
    });

const page = client.getPage();

@roysG great.

How are you determining that it's not using the proxy? Is there a new error? To be honest, it would've been a much quicker process if you DMd me on discord and I remoted to your machine to fix this.

I open site whatismyip

On Fri, 31 Jul 2020, 16:36 Mohammed Shah notifications@github.com wrote:

@roysG https://github.com/roysG great.

How are you determining that it's not using the proxy? Is there a new
error? To be honest, it would've been a much quicker process if you DMd me
on discord and I remoted to your machine to fix this.

β€”
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/open-wa/wa-automate-nodejs/issues/670#issuecomment-667123399,
or unsubscribe
https://github.com/notifications/unsubscribe-auth/ABXZDOR3C72OT6OCYJEFILLR6LCHTANCNFSM4PFOTL4Q
.

@roysG PLEASE open discord and message me. I will be able to figure out what's going on VERY quickly from there. This back and forth is mind-numbingly slow for what I'm sure is a simple problem.

link: https://discord.gg/dnpp72a

I will be closing this now. Thanks

Also, you have to open whatsmyip in the same tab as whatsapp web as the proxy is set per page. A new tab will not have the proxy running on it.

working!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

sandro-salles picture sandro-salles  Β·  4Comments

alishahlakhani picture alishahlakhani  Β·  7Comments

vsilva472 picture vsilva472  Β·  4Comments

DeLuca92 picture DeLuca92  Β·  5Comments

phantom-limb picture phantom-limb  Β·  5Comments