Closed mcroni closed 4 years ago
Same problem here.
(node:9872) UnhandledPromiseRejectionWarning: Error: Evaluation failed: ReferenceError: webpackJsonp is not defined at __puppeteer_evaluation_script__:3:29 at ExecutionContext._evaluateInternal
@ramonck @mcroni
I'm not able able to recreate this issue. Can you all please share more details:
You can find all this in the issue template.
@mcroni please also share which language you whatsapp web instance is running.
"sulla-hotfix": {
"version": "1.6.7",
"resolved": "https://registry.npmjs.org/sulla-hotfix/-/sulla-hotfix-1.6.7.tgz",
"integrity": "sha512-pyt4WOl+Pgho0OlFrnCWLmvzwN609gPE0QDyMOWEZ+wLiznfSP5Gqq9d99UIkjDNMfmjGT7iTLu+dOt1v40UpA==",
"requires": {
"atob": "^2.1.2",
"axios": "^0.19.1",
"death": "^1.1.0",
"eventemitter2": "^6.0.0",
"futoin-hkdf": "^1.2.1",
"image-type": "^4.1.0",
"ora": "^4.0.2",
"puppeteer": "^2.0.0",
"puppeteer-extra": "^2.1.3",
"puppeteer-extra-plugin-stealth": "^2.2.2",
"qrcode-terminal": "^0.12.0",
"request": "^2.88.0",
"request-promise": "^4.2.4",
"rxjs": "^6.5.3",
"shelljs": "^0.8.3"
}
},
Screenshot:
Test code:
const sulla = require('sulla-hotfix');
sulla.create('another_session', {headless:false}).then(client => start(client));
function start(client) {
client.onMessage(message => {
if (message.body === 'Hi') {
client.sendText(message.from, '👋 Hello from sulla!');
}
});
}
OS: Windows 10 Language: Portuguese
Thanks @ramonck
@ramonck can you check out the best practices on the readme.md and implement your own user agent. This issue is happening because your websocket on your instance is being flagged with a TOS_BLOCK so you need to set a custom user agent (at least) to cleanse your instance of that flag. One obvious cause of this would be the fact that you are running on a windows machine with safari in the user agent (that's the default).
Hi @smashah ,
I have made those changes but it's still complaining.
Now I tried also in another folder and it started working fine, yes you're correct. I have no idea what TOS_Block is will have to search but I will follow those best practices later thanks.
Terms of service block. Something or some things about your instance/IP address + other things are resulting in facebook blocking it.
I don't know what those things are exactly as they get determined in WhatsApp's servers.
@ramonck @mcroni https://github.com/smashah/sulla/issues/75#issuecomment-580262533
to circumvent Chrome version 49+ I always ask to open the group link instead of the home page
await this.instance['page'].goto('https://web.whatsapp.com'); to await this.instance['page'].goto('https://web.whatsapp.com/accept?code=9WbFp5GrNnT9vcV7tB****');
@duzaq interesting approach.
How can I change the url in the sulla.create or maybe before using that this.instance[page] ? I want to test this url schema to see if it minimizes the TOS Block.
Best Regards,
@ramonck this should work:
create('session',
{
executablePath: '/Applications/Google Chrome.app/Contents/MacOS/Google Chrome',
headless:false,
autoRefresh:false,
whatsappUrl: 'https://web.whatsapp.com/accept?code=9WbFp5GrNnT9vcV7tB****'
},
uaOverride
)
to circumvent Chrome version 49+ I always ask to open the group link instead of the home page
await this.instance['page'].goto('https://web.whatsapp.com'); to await this.instance['page'].goto('https://web.whatsapp.com/accept?code=9WbFp5GrNnT9vcV7tB****');
Interesting work around. I'll see if there's a more universal method instead of joining a group. Keep us updated with this in a new issue.
@mcroni @ramonck This issue is fixed in v1.6.15
I did get TOS Blocked even with the group url now. Debug Info { WA_VERSION: 'I think you have been TOS_BLOCKed', PAGE_UA: 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) ' + 'AppleWebKit/537.36 (KHTML, like Gecko) ' + 'Chrome/79.0.3945.130 Safari/537.36' }
Where do I get this information in the code? Is there a Sulla.debug variable?
@ramonck no, it's printed out in the beginning so then you lot can share it in issues when I ask you for it.
You do not have any WhatsApp string in your user agent. Why are you overriding it? If you override the ua then please append the WhatsApp part onto your custom ua.
@ramonck no, it's printed out in the beginning so then you lot can share it in issues when I ask you for it.
You do not have any WhatsApp string in your user agent. Why are you overriding it? If you override the ua then please append the WhatsApp part onto your custom ua.
Hi @smashah I'm overriding because you said it was best to override with a custom string so I grabbed my browser's UA and did an override. Not sure about how to append the WA portion what should be that?
@ramonck fair enough. I think I'll add some code to automatically add the WhatsApp part in a custom UA override. In the meantime please use this as your custom ua:
WhatsApp/0.4.315 Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.130 Safari/537.36
Now I got a TOS Blocked on the second execution haha.
@ramonck Ok how about:
WhatsApp/0.4.315 Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.130 Safari/537.36
hi team ,sorry for the late update and thanks for the help , i managed to create the instance with headless
set to false was able to scan, i was actually trying to scan using the code generating on the cmd
screen. I also noticed the textbox doesn't appear when chrome opens, is this intentional?
debug info: Debug Info { WA_VERSION: '0.4.930', PAGE_UA: 'WhatsApp/0.4.315 Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.130 Safari/537.36', SULLA_HOTFIX_VERSION: '1.7.28', BROWSER_VERSION: 'Chrome/79.0.3945.130' }
### I have a problem as below
(node:17084) UnhandledPromiseRejectionWarning: Error: Evaluation failed: ReferenceError: getQrPng is not defined
at puppeteer_evaluation_script:1:1
at ExecutionContext._evaluateInternal (D:\wabot\Whatsapp Bot Mikasa\node_modules\puppeteer\lib\cjs\puppeteer\common\ExecutionContext.js:172:23)
at processTicksAndRejections (internal/process/task_queues.js:93:5)
at async ExecutionContext.evaluate (D:\wabot\Whatsapp Bot Mikasa\node_modules\puppeteer\lib\cjs\puppeteer\common\ExecutionContext.js:107:16)
(Use node --trace-warnings ...
to show where the warning was created)
(node:17084) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag --unhandled-rejections=strict
(see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:17084) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
(node:17084) UnhandledPromiseRejectionWarning: Error: Evaluation failed: ReferenceError: getQrPng is not defined at puppeteer_evaluation_script:1:1
Hi, trying to scan the console generate QR code but it doesn't seem it work, any workaround for this? Thanks