chrishubert / whatsapp-api

This project is a REST API wrapper for the whatsapp-web.js library, providing an easy-to-use interface to interact with the WhatsApp Web platform.
https://www.christophehubert.com
Other
905 stars 404 forks source link

Strange errors and operations #196

Open LorisXP opened 7 months ago

LorisXP commented 7 months ago

Hello everyone, after updating the container to the latest available version, I have new issues. Also, the software is behaving strangely.

When I try to obtain the QR code, I always get this error, but it still returns it anyway:

whatsapp_web_api  | Failed to send new message webhook: <SESSION_NAME> qr Request failed with status code 404 {
whatsapp_web_api  |   qr: '2@bDvutCfQA198azRhI..etc'

Then when I connect with my phone anyway, for WhatsApp mobile there are no problems, it seems connected. However, in the log, this still appears:

Failed to send new message webhook: <SESSION_NAME>  loading_screen Request failed with status code 404 { percent: 0, message: 'Loading your chats' }
whatsapp_web_api  | Failed to send new message webhook: <SESSION_NAME>  loading_screen Request failed with status code 404 { percent: 100, message: 'Loading your chats' }
whatsapp_web_api  | Failed to send new message webhook: <SESSION_NAME>  authenticated Request failed with status code 404 
whatsapp_web_api  | Failed to send new message webhook: <SESSION_NAME>  ready Request failed with status code 404 
whatsapp_web_api  | Failed to send new message webhook: 400 contact_changed Request failed with status code 404 {

As soon as I try to send a message, it tells me that I'm not connected to the session and therefore it doesn't let me send it, crashing the container with this error:

whatsapp_web_api  | Failed to send new message webhook: 400 disconnected Request failed with status code 404 { reason: 'NAVIGATION' }
whatsapp_web_api  | /usr/src/app/node_modules/puppeteer-core/lib/cjs/puppeteer/common/Connection.js:329
whatsapp_web_api  |                 error: new Errors_js_1.ProtocolError(),
whatsapp_web_api  |                        ^
whatsapp_web_api  | 
whatsapp_web_api  | ProtocolError: Protocol error (Network.getResponseBody): Target closed.
whatsapp_web_api  |     at /usr/src/app/node_modules/puppeteer-core/lib/cjs/puppeteer/common/Connection.js:329:24
whatsapp_web_api  |     at new Promise (<anonymous>)
whatsapp_web_api  |     at CDPSessionImpl.send (/usr/src/app/node_modules/puppeteer-core/lib/cjs/puppeteer/common/Connection.js:325:16)
whatsapp_web_api  |     at /usr/src/app/node_modules/puppeteer-core/lib/cjs/puppeteer/common/HTTPResponse.js:140:100
whatsapp_web_api  |     at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
whatsapp_web_api  |     at async HTTPResponse.text (/usr/src/app/node_modules/puppeteer-core/lib/cjs/puppeteer/common/HTTPResponse.js:160:25)
whatsapp_web_api  |     at async /usr/src/app/node_modules/whatsapp-web.js/src/Client.js:778:39 {
whatsapp_web_api  |   originalMessage: ''
whatsapp_web_api  | }

Since the container crashed, when Docker restarts it, it resumes the session, and magically when I call the message sending API, it works correctly again. However, as soon as I disconnect the session and retry the process, it doesn't work anymore.

How can I solve this? Thank you to anyone who will help me, I wish you all a good day.

gamingflexer commented 7 months ago

Same here!

chrishubert commented 7 months ago

There was some confusion in the last commit — it has been reverted. You are trying to ping the development callback server that has been disabled in the last commit. Please set the option ENABLE_LOCAL_CALLBACK_EXAMPLE=TRUE in your docker-compose.yaml or pull the latest version of the repository.

LorisXP commented 7 months ago

There was some confusion in the last commit — it has been reverted. You are trying to ping the development callback server that has been disabled in the last commit. Please set the option ENABLE_LOCAL_CALLBACK_EXAMPLE=TRUE in your docker-compose.yaml or pull the latest version of the repository.

I've taken your latest commit, added the CORS as always. As soon as I activate the server, I see this log entry:

whatsapp_web_api  | > whatsapp-web-api@1.0.0 start
whatsapp_web_api  | > node server.js
whatsapp_web_api  | 
whatsapp_web_api  | Server running on port 3000
whatsapp_web_api  |

I obtain the QR code without errors, as soon as I scan it, the phone appears to be connected correctly. However, in the log, I see: whatsapp_web_api | Initialize error: Execution context was destroyed, most likely because of a navigation.

The session isn't created and, of course, the submission doesn't start. I don't know what else to do. It's not the CORS's fault because I had enabled them without problems in the past.

How can I solve this? Thank you to anyone who will help me, I wish you all a good day.

LorisXP commented 7 months ago

Any update?

gamingflexer commented 7 months ago

Running it locally works for me !

KaianS commented 6 months ago

Any updates?