pedroslopez / whatsapp-web.js

A WhatsApp client library for NodeJS that connects through the WhatsApp Web browser app
https://wwebjs.dev
Apache License 2.0
15.05k stars 3.58k forks source link

Target closed.. #2364

Closed chandrahas316 closed 9 months ago

chandrahas316 commented 1 year ago

Is there an existing issue for this?

Describe the bug

ProtocolError: Protocol error (Network.getResponseBody): Target closed.

I am facing this error after using

await client.logout()

user is getting logged out successfully but i am still getting this error.

someone help me out...

Expected behavior

As a user, i expect no errors and user getting logged out successfully. but i am facing this error in few cases only even though user is getting logged out successfully.

Steps to Reproduce the Bug or Issue

client.on('qr'){ } // qr generation event

client.on('ready'){ } //ready event

client.initialize() //client initialization

await client.logout() //logout

Relevant Code

No response

Browser Type

Chromium

WhatsApp Account Type

Standard

Does your WhatsApp account have multidevice enabled?

Yes, I am using Multi Device

Environment

using linux environment

Additional context

No response

lucasfmoreno commented 1 year ago

Same here but on Windows and single device.

kernelsystem2017 commented 1 year ago

Hello... in my case, inside Client.js I put the method context, initialize() inside the try catch, if catch is called, and the error message is target closed, I call the method itself... this.initialize()

opssemnik commented 1 year ago

fixed by https://github.com/pedroslopez/whatsapp-web.js/pull/2175

metaworker commented 1 year ago

I have a question.This error is not obvious on Windows environment, but it often happens on Linux.By the way, the old version for whatsappweb.js seems normal.

bmmangukiya commented 1 year ago

Still Having the same issue

KhalelAlbuquerque commented 7 months ago

I had to change the module file

Path: node_modules/whatsapp-web.js/src/Client.js

Line 744: await webCache.persist(await res.text());

Change for: try{ await webCache.persist(await res.text()); }catch(err){ console.log(err.message) }

Thx for @ting7777