devlikeapro / waha

WAHA - WhatsApp HTTP API (REST API) that you can configure in a click!
https://waha.devlike.pro/
Apache License 2.0
813 stars 248 forks source link

[BUG][WEBJS] - Session not starting #312

Closed 5and0 closed 1 month ago

5and0 commented 2 months ago

Session not starting

When starting, even with defaults the session hangs "STARTING" without further information in the logs...

[Nest] 30 - 04/30/2024, 10:35:34 PM LOG [SessionManager] 'default' - starting session...

2024.4.4

{
  version: '2024.4.4',
  engine: 'WEBJS',
  tier: 'PLUS',
  browser: '/usr/bin/chromium'
}

To Reproduce Steps to reproduce the behavior:

  1. Start session with defaults

Expected behavior

status to change from STARTING to SCANQRCODE

Engine I'm using WEBJS engine.

Requests - Responses

{ "name": "default", "config": { "proxy": null, "debug": true } }

Response:

{ "name": "default", "status": "STARTING", "config": { "proxy": null, "debug": true } }

Docker Logs

[Nest] 30 - 04/30/2024, 10:34:50 PM LOG [InstanceLoader] ConfigHostModule dependencies initialized +1ms [Nest] 30 - 04/30/2024, 10:34:50 PM LOG [InstanceLoader] TerminusModule dependencies initialized +0ms [Nest] 30 - 04/30/2024, 10:34:50 PM LOG [InstanceLoader] ConfigModule dependencies initialized +0ms [Nest] 30 - 04/30/2024, 10:34:50 PM LOG [SessionManager] Using local storage for session info. [Nest] 30 - 04/30/2024, 10:34:50 PM LOG [Storage] Directory '/tmp/whatsapp-files' created from scratch [Nest] 30 - 04/30/2024, 10:34:50 PM LOG [InstanceLoader] ServeStaticModule dependencies initialized +1ms [Nest] 30 - 04/30/2024, 10:34:50 PM LOG [InstanceLoader] AppModulePlus dependencies initialized +1ms Please set up both WHATSAPP_SWAGGER_USERNAME and WHATSAPP_SWAGGER_PASSWORD to enable swagger authentication. [Nest] 30 - 04/30/2024, 10:34:50 PM LOG [RoutesResolver] AuthController {/api/:session/auth}: +62ms [Nest] 30 - 04/30/2024, 10:34:50 PM LOG [RouterExplorer] Mapped {/api/:session/auth/qr, GET} route +1ms [Nest] 30 - 04/30/2024, 10:34:50 PM LOG [RouterExplorer] Mapped {/api/:session/auth/request-code, POST} route +0ms [Nest] 30 - 04/30/2024, 10:34:50 PM LOG [RouterExplorer] Mapped {/api/:session/auth/authorize-code, POST} route +0ms [Nest] 30 - 04/30/2024, 10:34:50 PM LOG [RouterExplorer] Mapped {/api/:session/auth/captcha, GET} route +1ms [Nest] 30 - 04/30/2024, 10:34:50 PM LOG [RouterExplorer] Mapped {/api/:session/auth/captcha, POST} route +0ms [Nest] 30 - 04/30/2024, 10:34:50 PM LOG [RoutesResolver] SessionsController {/api/sessions}: +0ms [Nest] 30 - 04/30/2024, 10:34:50 PM LOG [RouterExplorer] Mapped {/api/sessions/start, POST} route +0ms [Nest] 30 - 04/30/2024, 10:34:50 PM LOG [RouterExplorer] Mapped {/api/sessions/stop, POST} route +1ms [Nest] 30 - 04/30/2024, 10:34:50 PM LOG [RouterExplorer] Mapped {/api/sessions/logout, POST} route +0ms [Nest] 30 - 04/30/2024, 10:34:50 PM LOG [RouterExplorer] Mapped {/api/sessions, GET} route +1ms [Nest] 30 - 04/30/2024, 10:34:50 PM LOG [RouterExplorer] Mapped {/api/sessions/:session, GET} route +0ms [Nest] 30 - 04/30/2024, 10:34:50 PM LOG [RoutesResolver] SessionController {/api/sessions/:session}: +0ms [Nest] 30 - 04/30/2024, 10:34:50 PM LOG [RouterExplorer] Mapped {/api/sessions/:session/me, GET} route +0ms [Nest] 30 - 04/30/2024, 10:34:50 PM LOG [RoutesResolver] ChattingController {/api}: +0ms [Nest] 30 - 04/30/2024, 10:34:50 PM LOG [RouterExplorer] Mapped {/api/checkNumberStatus, GET} route +0ms [Nest] 30 - 04/30/2024, 10:34:50 PM LOG [RouterExplorer] Mapped {/api/sendContactVcard, POST} route +1ms [Nest] 30 - 04/30/2024, 10:34:50 PM LOG [RouterExplorer] Mapped {/api/sendText, GET} route +0ms [Nest] 30 - 04/30/2024, 10:34:50 PM LOG [RouterExplorer] Mapped {/api/sendText, POST} route +0ms [Nest] 30 - 04/30/2024, 10:34:50 PM LOG [RouterExplorer] Mapped {/api/sendPoll, POST} route +0ms [Nest] 30 - 04/30/2024, 10:34:50 PM LOG [RouterExplorer] Mapped {/api/sendLocation, POST} route +0ms [Nest] 30 - 04/30/2024, 10:34:50 PM LOG [RouterExplorer] Mapped {/api/sendLinkPreview, POST} route +0ms [Nest] 30 - 04/30/2024, 10:34:50 PM LOG [RouterExplorer] Mapped {/api/sendImage, POST} route +0ms [Nest] 30 - 04/30/2024, 10:34:50 PM LOG [RouterExplorer] Mapped {/api/sendFile, POST} route +0ms [Nest] 30 - 04/30/2024, 10:34:50 PM LOG [RouterExplorer] Mapped {/api/sendVoice, POST} route +1ms [Nest] 30 - 04/30/2024, 10:34:50 PM LOG [RouterExplorer] Mapped {/api/sendVideo, POST} route +0ms [Nest] 30 - 04/30/2024, 10:34:50 PM LOG [RouterExplorer] Mapped {/api/reply, POST} route +0ms [Nest] 30 - 04/30/2024, 10:34:50 PM LOG [RouterExplorer] Mapped {/api/sendSeen, POST} route +0ms [Nest] 30 - 04/30/2024, 10:34:50 PM LOG [RouterExplorer] Mapped {/api/startTyping, POST} route +0ms [Nest] 30 - 04/30/2024, 10:34:50 PM LOG [RouterExplorer] Mapped {/api/stopTyping, POST} route +0ms [Nest] 30 - 04/30/2024, 10:34:50 PM LOG [RouterExplorer] Mapped {/api/reaction, PUT} route +0ms [Nest] 30 - 04/30/2024, 10:34:50 PM LOG [RouterExplorer] Mapped {/api/star, PUT} route +1ms [Nest] 30 - 04/30/2024, 10:34:50 PM LOG [RouterExplorer] Mapped {/api/messages, GET} route +0ms [Nest] 30 - 04/30/2024, 10:34:50 PM LOG [RoutesResolver] ChatsController {/api/:session/chats}: +0ms [Nest] 30 - 04/30/2024, 10:34:50 PM LOG [RouterExplorer] Mapped {/api/:session/chats, GET} route +0ms [Nest] 30 - 04/30/2024, 10:34:50 PM LOG [RouterExplorer] Mapped {/api/:session/chats/:chatId, DELETE} route +0ms [Nest] 30 - 04/30/2024, 10:34:50 PM LOG [RouterExplorer] Mapped {/api/:session/chats/:chatId/messages, GET} route +0ms [Nest] 30 - 04/30/2024, 10:34:50 PM LOG [RouterExplorer] Mapped {/api/:session/chats/:chatId/messages, DELETE} route +1ms [Nest] 30 - 04/30/2024, 10:34:50 PM LOG [RouterExplorer] Mapped {/api/:session/chats/:chatId/messages/:messageId, DELETE} route +0ms [Nest] 30 - 04/30/2024, 10:34:50 PM LOG [RouterExplorer] Mapped {/api/:session/chats/:chatId/messages/:messageId, PUT} route +0ms [Nest] 30 - 04/30/2024, 10:34:50 PM LOG [RoutesResolver] StatusController {/api/:session/status}: +0ms [Nest] 30 - 04/30/2024, 10:34:50 PM LOG [RouterExplorer] Mapped {/api/:session/status/text, POST} route +0ms [Nest] 30 - 04/30/2024, 10:34:50 PM LOG [RouterExplorer] Mapped {/api/:session/status/image, POST} route +0ms [Nest] 30 - 04/30/2024, 10:34:50 PM LOG [RouterExplorer] Mapped {/api/:session/status/voice, POST} route +0ms [Nest] 30 - 04/30/2024, 10:34:50 PM LOG [RouterExplorer] Mapped {/api/:session/status/video, POST} route +0ms [Nest] 30 - 04/30/2024, 10:34:50 PM LOG [RoutesResolver] ContactsController {/api/contacts}: +0ms [Nest] 30 - 04/30/2024, 10:34:50 PM LOG [RouterExplorer] Mapped {/api/contacts, GET} route +1ms [Nest] 30 - 04/30/2024, 10:34:50 PM LOG [RouterExplorer] Mapped {/api/contacts/all, GET} route +0ms [Nest] 30 - 04/30/2024, 10:34:50 PM LOG [RouterExplorer] Mapped {/api/contacts/check-exists, GET} route +0ms [Nest] 30 - 04/30/2024, 10:34:50 PM LOG [RouterExplorer] Mapped {/api/contacts/about, GET} route +0ms [Nest] 30 - 04/30/2024, 10:34:50 PM LOG [RouterExplorer] Mapped {/api/contacts/profile-picture, GET} route +0ms [Nest] 30 - 04/30/2024, 10:34:50 PM LOG [RouterExplorer] Mapped {/api/contacts/block, POST} route +0ms [Nest] 30 - 04/30/2024, 10:34:50 PM LOG [RouterExplorer] Mapped {/api/contacts/unblock, POST} route +0ms [Nest] 30 - 04/30/2024, 10:34:50 PM LOG [RoutesResolver] GroupsController {/api/:session/groups}: +0ms [Nest] 30 - 04/30/2024, 10:34:50 PM LOG [RouterExplorer] Mapped {/api/:session/groups, POST} route +0ms [Nest] 30 - 04/30/2024, 10:34:50 PM LOG [RouterExplorer] Mapped {/api/:session/groups, GET} route +0ms [Nest] 30 - 04/30/2024, 10:34:50 PM LOG [RouterExplorer] Mapped {/api/:session/groups/:id, GET} route +0ms [Nest] 30 - 04/30/2024, 10:34:50 PM LOG [RouterExplorer] Mapped {/api/:session/groups/:id/settings/security/info-admin-only, PUT} route +1ms [Nest] 30 - 04/30/2024, 10:34:50 PM LOG [RouterExplorer] Mapped {/api/:session/groups/:id/settings/security/info-admin-only, GET} route +0ms [Nest] 30 - 04/30/2024, 10:34:50 PM LOG [RouterExplorer] Mapped {/api/:session/groups/:id/settings/security/messages-admin-only, PUT} route +0ms [Nest] 30 - 04/30/2024, 10:34:50 PM LOG [RouterExplorer] Mapped {/api/:session/groups/:id/settings/security/messages-admin-only, GET} route +0ms [Nest] 30 - 04/30/2024, 10:34:50 PM LOG [RouterExplorer] Mapped {/api/:session/groups/:id, DELETE} route +0ms [Nest] 30 - 04/30/2024, 10:34:50 PM LOG [RouterExplorer] Mapped {/api/:session/groups/:id/leave, POST} route +0ms [Nest] 30 - 04/30/2024, 10:34:50 PM LOG [RouterExplorer] Mapped {/api/:session/groups/:id/description, PUT} route +0ms [Nest] 30 - 04/30/2024, 10:34:50 PM LOG [RouterExplorer] Mapped {/api/:session/groups/:id/subject, PUT} route +0ms [Nest] 30 - 04/30/2024, 10:34:50 PM LOG [RouterExplorer] Mapped {/api/:session/groups/:id/invite-code, GET} route +1ms [Nest] 30 - 04/30/2024, 10:34:50 PM LOG [RouterExplorer] Mapped {/api/:session/groups/:id/invite-code/revoke, POST} route +0ms [Nest] 30 - 04/30/2024, 10:34:50 PM LOG [RouterExplorer] Mapped {/api/:session/groups/:id/participants, GET} route +0ms [Nest] 30 - 04/30/2024, 10:34:50 PM LOG [RouterExplorer] Mapped {/api/:session/groups/:id/participants/add, POST} route +0ms [Nest] 30 - 04/30/2024, 10:34:50 PM LOG [RouterExplorer] Mapped {/api/:session/groups/:id/participants/remove, POST} route +0ms [Nest] 30 - 04/30/2024, 10:34:50 PM LOG [RouterExplorer] Mapped {/api/:session/groups/:id/admin/promote, POST} route +0ms [Nest] 30 - 04/30/2024, 10:34:50 PM LOG [RouterExplorer] Mapped {/api/:session/groups/:id/admin/demote, POST} route +1ms [Nest] 30 - 04/30/2024, 10:34:50 PM LOG [RoutesResolver] PresenceController {/api/:session/presence}: +0ms [Nest] 30 - 04/30/2024, 10:34:50 PM LOG [RouterExplorer] Mapped {/api/:session/presence, POST} route +0ms [Nest] 30 - 04/30/2024, 10:34:50 PM LOG [RouterExplorer] Mapped {/api/:session/presence, GET} route +0ms [Nest] 30 - 04/30/2024, 10:34:50 PM LOG [RouterExplorer] Mapped {/api/:session/presence/:chatId, GET} route +0ms [Nest] 30 - 04/30/2024, 10:34:50 PM LOG [RouterExplorer] Mapped {/api/:session/presence/:chatId/subscribe, POST} route +0ms [Nest] 30 - 04/30/2024, 10:34:50 PM LOG [RoutesResolver] ScreenshotController {/api}: +0ms [Nest] 30 - 04/30/2024, 10:34:50 PM LOG [RouterExplorer] Mapped {/api/screenshot, GET} route +0ms [Nest] 30 - 04/30/2024, 10:34:50 PM LOG [RoutesResolver] VersionController {/api/version}: +1ms [Nest] 30 - 04/30/2024, 10:34:50 PM LOG [RouterExplorer] Mapped {/api/version, GET} route +0ms [Nest] 30 - 04/30/2024, 10:34:50 PM LOG [RoutesResolver] HealthController {/health}: +0ms [Nest] 30 - 04/30/2024, 10:34:50 PM LOG [RouterExplorer] Mapped {/health, GET} route +0ms [Nest] 30 - 04/30/2024, 10:34:50 PM LOG [NestApplication] Nest application successfully started +2ms WhatsApp HTTP API is running on: http://[::1]:3000 Environment: { version: '2024.4.4', engine: 'WEBJS', tier: 'PLUS', browser: '/usr/bin/chromium' } [Nest] 30 - 04/30/2024, 10:35:34 PM LOG [SessionManager] 'default' - starting session...

Screenshots

N/A

Additional context

Only just updated to new image.

patron:PLUS

allburov commented 2 months ago

Hi! Could you run the session with config.debug: True flag in the request and send logs here please :pray: https://waha.devlike.pro/docs/how-to/sessions/#enable-debug

patron:PRO

5and0 commented 2 months ago

Used the following to start the session and I am not seeing anything more in addition to above ....

{ "name": "default", "status": "STARTING", "config": { "debug": true } }

patron:PLUS

allburov commented 2 months ago

Just published a new version. 2024.5.1, could you update and test this one?

patron:PRO

5and0 commented 2 months ago

Same issue sadly ... recreated the container and still seeing the same problem.

patron:PLUS

allburov commented 2 months ago

Hi! Sorry for asking dump question, but could you try to run a different session, like default2

{
  "name": "default2",
  "config": {
    "proxy": null,
    "webhooks": [
      {
        "url": "https://httpbin.org/post",
        "events": [
          "message",
          "session.status"
        ],
        "hmac": null,
        "retries": null,
        "customHeaders": null
      }
    ],
    "debug": false
  }
}

patron:PRO

5and0 commented 2 months ago

[ { "name": "default", "status": "STARTING", "config": { "debug": true }, "me": null, "engine": { "engine": "WEBJS" } }, { "name": "default2", "status": "STARTING", "config": { "proxy": null, "webhooks": [ { "url": "https://httpbin.org/post", "events": [ "message", "session.status" ], "hmac": null, "retries": null, "customHeaders": null } ], "debug": false }, "me": null, "engine": { "engine": "WEBJS" } } ]

patron:PLUS

5and0 commented 2 months ago

Still stuck starting ...

patron:PLUS

allburov commented 2 months ago

What is your country for the phone number and where your server is?

patron:PRO

5and0 commented 2 months ago

+61, Australia

patron:PLUS

allburov commented 2 months ago

@5and0 what the /screenshot shows when it's in STARTING status btw, didn't find it in the messages?

patron:PRO

allburov commented 2 months ago

Likely relates to https://github.com/devlikeapro/whatsapp-http-api/issues/296

patron:PRO

5and0 commented 2 months ago

image

patron:PLUS

5and0 commented 2 months ago

That is after it’s been running for a while.. initially I get…

{ "statusCode": 500, "timestamp": "2024-05-04T02:07:33.531Z", "exception": { "stack": "ProtocolError: Protocol error (Page.captureScreenshot): Cannot take screenshot with 0 width.\n at /app/node_modules/whatsapp-web.js/node_modules/puppeteer-core/lib/cjs/puppeteer/common/Connection.js:329:24\n at new Promise (<anonymous>)\n at CDPSessionImpl.send (/app/node_modules/whatsapp-web.js/node_modules/puppeteer-core/lib/cjs/puppeteer/common/Connection.js:325:16)\n at CDPPage._CDPPage_screenshotTask (/app/node_modules/whatsapp-web.js/node_modules/puppeteer-core/lib/cjs/puppeteer/common/Page.js:2591:77)\n at process.processTicksAndRejections (node:internal/process/task_queues:95:5)", "name": "ProtocolError", "originalMessage": "Cannot take screenshot with 0 width.", "message": "Protocol error (Page.captureScreenshot): Cannot take screenshot with 0 width." }, "request": { "path": "/api/screenshot?session=default", "method": "GET", "body": {}, "query": { "session": "default" } }, "version": { "version": "2024.5.1", "engine": "WEBJS", "tier": "PLUS", "browser": "/usr/bin/chromium" } }

patron:PLUS

allburov commented 2 months ago

Sorry for asking, did you try to completely remove .sessions folder? Or may be connect a new folder, .sessions2

As long as WhatsApp Web itself is loading, nothing we can do here :(

patron:PRO

allburov commented 2 months ago

Enough CPU and free Memory, right? Just wanna make sure it's not usual problems :)

patron:PRO

5and0 commented 2 months ago

Yes. Did both. Will try again tonight. Tried different engine as well.

patron:PLUS

5and0 commented 2 months ago

Enough CPU and free Memory, right? Just wanna make sure it's not usual problems :)

patron:PRO

Yes

patron:PLUS

allburov commented 2 months ago

One more thing to try - using chrome based (not chromium) docker image

https://waha.devlike.pro/docs/how-to/engines/#docker-images

This one:

devlikeapro/whatsapp-http-api-plus:chrome

May be it's some sort of bug in chromium + whatsapp web

patron:PRO

allburov commented 2 months ago

@5and0 is the account old one or new? With old one it can have too many messages in it, so syncing takes long (weird tho, we should get some logs there in that case)

patron:PRO

5and0 commented 2 months ago

@5and0 is the account old one or new? With old one it can have too many messages in it, so syncing takes long (weird tho, we should get some logs there in that case)

patron:PRO

Old account, but not even getting to the point of logging in, so not sure how that would impact at this point.

patron:PLUS

5and0 commented 2 months ago

Ok ... got it working with :chrome and version 2024.5.3 ... if I switch back to chromium I notice version is 2024.5.2 even after removing and pulling latest image.

patron:PLUS

5and0 commented 2 months ago

I'm also getting this at the top of the conversation list ...

image

patron:PLUS

5and0 commented 1 month ago

Should I continue to use Chrome ? Even if it is saying "Update available" ? I have been logged out before by WhatsApp for using an unsupported device/version.

patron:PLUS

allburov commented 1 month ago

Should I continue to use Chrome ?

Yes please! idk why it doesn't work with chromium for you...

Even if it is saying "Update available"

That's fine, we pin exact version, so we don't get the latest version with unknown updates. We're working on supporting new version as well, but it's in "alpha" phase even in Meta.

Let me know if there's anything we can help you with!

patron:PRO