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
845 stars 385 forks source link

Cannot create qr #287

Open Tsjippy opened 5 days ago

Tsjippy commented 5 days ago

Thank you for this great package.

I have installed it on a rpi3b. I access it fro a winows 11 machine

This command http://192.168.0.202:3000/session/start/test runs fine.

But this command http://192.168.0.202:3000/session/qr/test leads to the following error:

 npm run start

> whatsapp-web-api@1.0.0 start
> node server.js

(node:24289) [DEP0040] DeprecationWarning: The `punycode` module is deprecated. Please use a userland alternative instead.
(Use `node --trace-deprecation ...` to show where the warning was created)
Server running on port 3000
existing session detected birhtdays
existing session detected birthdays
Initialize error: Failed to launch the browser process!
/home/pi/whatsapp-api/node_modules/puppeteer-core/.local-chromium/linux-1045629/chrome-linux/chrome: 1: cannot create �v@H�@8
@$@@@����
�v
�v�v�v�v�s�     �s�     �#$
�C$
�C$
��{��{ �
P�
P�
��(�#$
�C$
�C$
��@�i�
���
���
�R�td�#$
�C$
�C$
��{��{P�td@@@�M;�M;Q�td���XX/lib64/ld-linux-x86-64.so.2GNU     INFOCrashpad<\�                                                                                                                                                              GNU�x���Ba p � ��������: Directory nonexistent
/home/pi/whatsapp-api/node_modules/puppeteer-core/.local-chromium/linux-1045629/chrome-linux/chrome: 1: Syntax error: Unterminated quoted string

TROUBLESHOOTING: https://github.com/puppeteer/puppeteer/blob/main/docs/troubleshooting.md

Initialize error: Failed to launch the browser process!
/home/pi/whatsapp-api/node_modules/puppeteer-core/.local-chromium/linux-1045629/chrome-linux/chrome: 1: cannot create �v@H�@8
@$@@@����
�v
�v�v�v�v�s�     �s�     �#$
�C$
�C$
��{��{ �
P�
P�
��(�#$
�C$
�C$
��@�i�
���
���
�R�td�#$
�C$
�C$
��{��{P�td@@@�M;�M;Q�td���XX/lib64/ld-linux-x86-64.so.2GNU     INFOCrashpad<\�                                                                                                                                                              GNU�x���Ba p � ��������: Directory nonexistent
/home/pi/whatsapp-api/node_modules/puppeteer-core/.local-chromium/linux-1045629/chrome-linux/chrome: 1: Syntax error: Unterminated quoted string

TROUBLESHOOTING: https://github.com/puppeteer/puppeteer/blob/main/docs/troubleshooting.md

PuTTYPuTTYInitialize error: Failed to launch the browser process!
/home/pi/whatsapp-api/node_modules/puppeteer-core/.local-chromium/linux-1045629/chrome-linux/chrome: 1: cannot create �v@H�@8
@$@@@����
�v
�v�v�v�v�s�     �s�     �#$
�C$
�C$
��{��{ �
P�
P�
��(�#$
�C$
�C$
��@�i�
���
���
�R�td�#$
�C$
�C$
��{��{P�td@@@�M;�M;Q�td���XX/lib64/ld-linux-x86-64.so.2GNU     INFOCrashpad<\�                                                                                                                                                              GNU�x���Ba p � ��������: Directory nonexistent
/home/pi/whatsapp-api/node_modules/puppeteer-core/.local-chromium/linux-1045629/chrome-linux/chrome: 1: Syntax error: Unterminated quoted string

TROUBLESHOOTING: https://github.com/puppeteer/puppeteer/blob/main/docs/troubleshooting.md

PuTTYTimed out waiting for nested object
Timed out waiting for nested object
Timed out waiting for nested object
Timed out waiting for nested object
node:_http_outgoing:699
    throw new ERR_HTTP_HEADERS_SENT('set');
          ^

Error [ERR_HTTP_HEADERS_SENT]: Cannot set headers after they are sent to the client
    at ServerResponse.setHeader (node:_http_outgoing:699:11)
    at ServerResponse.header (/home/pi/whatsapp-api/node_modules/express/lib/response.js:794:10)
    at ServerResponse.send (/home/pi/whatsapp-api/node_modules/express/lib/response.js:174:12)
    at ServerResponse.json (/home/pi/whatsapp-api/node_modules/express/lib/response.js:278:15)
    at sendErrorResponse (/home/pi/whatsapp-api/src/utils.js:12:22)
    at /home/pi/whatsapp-api/src/controllers/sessionController.js:47:25
    at process.processTicksAndRejections (node:internal/process/task_queues:105:5) {
  code: 'ERR_HTTP_HEADERS_SENT'
}

Node.js v22.11.0
avoylenko commented 5 days ago

I think the browser is not able to start due to architecture of your board. Try to install it from your repository and point the CHROME_BIN env to the executable.

Tsjippy commented 5 days ago

thanks for the quick reply.

That at least changed things.

Timed out waiting for nested object
Timed out waiting for nested object
node:_http_outgoing:699
    throw new ERR_HTTP_HEADERS_SENT('set');
          ^

Error [ERR_HTTP_HEADERS_SENT]: Cannot set headers after they are sent to the client
    at ServerResponse.setHeader (node:_http_outgoing:699:11)
    at ServerResponse.header (/home/pi/whatsapp-api/node_modules/express/lib/response.js:794:10)
    at ServerResponse.send (/home/pi/whatsapp-api/node_modules/express/lib/response.js:174:12)
    at ServerResponse.json (/home/pi/whatsapp-api/node_modules/express/lib/response.js:278:15)
    at sendErrorResponse (/home/pi/whatsapp-api/src/utils.js:12:22)
    at /home/pi/whatsapp-api/src/controllers/sessionController.js:47:25
    at process.processTicksAndRejections (node:internal/process/task_queues:105:5) {
  code: 'ERR_HTTP_HEADERS_SENT'
}

Node.js v22.11.0

If I run the url http://192.168.0.202:3000/session/qr/test again this is what I get:{"success":false,"error":"Session already exists for: test"}

avoylenko commented 4 days ago

@Tsjippy the ERR_HTTP_HEADERS_SENT error has been fixed and awaits @chrishubert approve

Tsjippy commented 4 days ago

Thank you.

for now I will just runs the thing on my laptop and copy the session folder to my rpi. See if that works