Closed YOEL311 closed 1 year ago
You don't have a proper Internet connection on your phone.
When I run on local machine it work as expected with my phone
// Done This To Fix IT !!!
const repl = require('repl'); const qrcode = require('qrcode-terminal');
const { Client, LocalAuth } = require('whatsapp-web.js');
const client = new Client({ puppeteer: { headless: true }, authStrategy: new LocalAuth() });
console.log('Initializing...');
client.initialize();
client.on('qr', qr => { qrcode.generate(qr, {small: true}); });
client.on('qr', () => { console.log('Please scan the QR code.'); });
client.on('ready', () => { console.log('Client is ready!'); });
client.on('ready', () => { const shell = repl.start('wwebjs> '); shell.context.client = client; shell.on('exit', async () => { await client.destroy(); }); });
client.on('message', message => { console.log(message.body); });
client.on('message', message => { if(message.body === '!ping') { message.reply('pong'); } });
Facing same issue, any solution to it??
Anyone Fixed this? I have same issue,works fine on local server.But on render free plan its gives error.
Is there an existing issue for this?
- [x] I have searched the existing issues
Describe the bug
I build my app on my local computer all work as expected when I push my code to the cloud (render.com, free plain) I got an error when scanning the QR "Couldn't log in. Check your phone's internet connection and scan the QR code again.
Expected behavior
get message The client is ready!
Steps to Reproduce the Bug or Issue
push code to the cloud scan QR code
Relevant Code
const qrcode = require('qrcode-terminal'); const { Client } = require('whatsapp-web.js'); const client = new Client(); client.on('qr', (qr) => { qrcode.generate(qr, { small: true }); }); client.on('ready', () => { console.log('Client is ready!'); }); client.initialize();
Browser Type
Google Chrome
WhatsApp Account Type
Standard
Does your WhatsApp account have multidevice enabled?
Yes, I am using Multi-Device
Environment
os: render.com platform free plan phone: Android Whatsapp-web.js version 1.7 || 1.8 alpha
Additional context
aa
you may try to deploy it on a virtual machine in google cloud or aws.
I faced this on 512 vm when I upgraded the vm to 2gig the issue solved
Thanks you are right
I have used GCP and working fine
On Sat, 1 Jul, 2023, 12:59 pm Base Juma, @.***> wrote:
I faced this on 512 vm when I upgraded the vm to 2gig the issue solved
— Reply to this email directly, view it on GitHub https://github.com/pedroslopez/whatsapp-web.js/issues/1726#issuecomment-1615593246, or unsubscribe https://github.com/notifications/unsubscribe-auth/AK2BGDDYBMNPQDTMRZOM2KTXN7GV5ANCNFSM6AAAAAARAUFEDU . You are receiving this because you commented.Message ID: @.***>
Any updates? I am also facing this problem.
Here is my code
server.js `const express = require('express'); const QRCode = require('qrcode');
const { Client, LocalAuth } = require('whatsapp-web.js');
const app = express(); const PORT = 5555;
app.use(express.json());
const API = require('./apiAuth'); const { users } = require('./initialData');
const client = new Client({ puppeteer: { executablePath: '/usr/bin/brave-browser-stable', }, authStrategy: new LocalAuth({ clientId: "client-one" }), puppeteer: { headless: true, args: [ '--no-sandbox', '--disable-gpu', '--disable-setuid-sandbox' ], } });
client.initialize();
client.on('qr', qr => {
app.get('/qr', API.authenticateKey, async (req, res) => {
QRCode.toDataURL(qr).then(url => {
res.send(<img src=${url}>
);
}).catch(err => {
console.error(err)
})
})
})
client.on('authenticated', session => { console.log('AUTHENTICATED'); });
client.on('ready', () => { console.log('Client is ready!');
app.get('/', (req, res) => { res.send('Hiii!'); });
app.get('/send-msg', API.authenticateKey, async (req, res) => {
/* @type {{ number: string; msg: string }} /
//const { number, msg } = req.body;
client
.sendMessage(55${1148582224}@c.us
, 'A')
.then(() => res.send('Message sent successfully'))
.catch(err => res.send(err).status(500));
});
app.get('/logout', API.authenticateKey, async (req, res) => { await client.logout(); res.send('Logged out'); //fs.unlink(SESSION_FILE_PATH, () => console.log('Session deleted')); process.exit(); }); });
app.get('/kill', API.authenticateKey, async () => { process.exit(); });
app.listen(PORT, () => console.log('Listening on port ' + PORT));
`
it is resolved in paid instance, you need terminal to install lib dependencies
use vm instance to run this with pm2 and nginx
Try with another mobile number that's not uses in these type library then it's work fine.
Is there an existing issue for this?
Describe the bug
I build my app on my local computer all work as expected when I push my code to the cloud (render.com, free plain) I got an error when scanning the QR "Couldn't log in. Check your phone's internet connection and scan the QR code again.
Expected behavior
get message The client is ready!
Steps to Reproduce the Bug or Issue
push code to the cloud scan QR code
Relevant Code
Browser Type
Google Chrome
WhatsApp Account Type
Standard
Does your WhatsApp account have multidevice enabled?
Yes, I am using Multi-Device
Environment
os: render.com platform free plan phone: Android Whatsapp-web.js version 1.7 || 1.8 alpha
Additional context
aa