devlikeapro / waha

WAHA - WhatsApp HTTP API (REST API) that you can configure in a click! Two engines: chromium-based WEBJS and pure-websocket NOWEB
https://waha.devlike.pro/
Apache License 2.0
954 stars 286 forks source link

[BUG][NOWEB] - Got unauthorized time to time #578

Open yeheskel2016 opened 11 hours ago

yeheskel2016 commented 11 hours ago

This would be super hard to explain so I will not follow the required format and just provide the logs I saw in case somehow it can help, I'm at 2024.9.2 version, having 2 sessions active, one is working OK the second one since this morning is in constant "Failed" state, no matter how many restarts / restart to the docker container it self, it would always be in Failed state, any request to it would return with error 500, I marked it to run in Debug so I could capture last logs but honestly not sure if you could understand what's the issue :

[05:41:45.462] INFO (NOWEBEngine/49): session:session_03yrw9 - connected to WA {"reqId":383,"session":"session_03yrw9","sessionRunTimestamp":1728452505125,"browser":["Ubuntu","Chrome","22.04.4"],"helloMsg":{"clientHello":{"ephemeral":"EZPbnK8N0fRrzg1CMFBOeMDpknVkKQVmJT0VTie/GVQ="}}} [05:41:45.608] INFO (NOWEBEngine/49): session:session_03yrw9 - logging in... {"reqId":383,"session":"session_03yrw9","sessionRunTimestamp":1728452505125,"node":{"username":"972552812481","passive":true,"userAgent":{"platform":"WEB","appVersion":{"primary":2,"secondary":3000,"tertiary":1015901307},"mcc":"000","mnc":"000","osVersion":"0.1","manufacturer":"","device":"Desktop","osBuildNumber":"0.1","releaseChannel":"RELEASE","localeLanguageIso6391":"en","localeCountryIso31661Alpha2":"US"},"webInfo":{"webSubPlatform":"WEB_BROWSER"},"connectType":"WIFI_UNKNOWN","connectReason":"USER_ACTIVATED","device":1}} [05:41:46.150] INFO (49): request completed {"reqId":384,"req":{"id":384,"method":"GET","url":"/api/version","query":{},"params":{"0":"api/version"}},"res":{"statusCode":304},"responseTime":1} [05:41:46.151] INFO (49): request completed {"reqId":386,"req":{"id":386,"method":"GET","url":"/api/server/status","query":{},"params":{"0":"api/server/status"}},"res":{"statusCode":200},"responseTime":0} [05:41:46.152] INFO (49): request completed {"reqId":385,"req":{"id":385,"method":"GET","url":"/api/sessions?all=true","query":{"all":"true"},"params":{"0":"api/sessions"}},"res":{"statusCode":200},"responseTime":2} [05:41:47.533] INFO (NOWEBEngine/49): session:session_03yrw9 - connection errored {"reqId":383,"session":"session_03yrw9","sessionRunTimestamp":1728452505125,"trace":"Error: Connection Failure\n at WebSocketClient. (/app/node_modules/@adiwajshing/baileys/lib/Socket/socket.js:529:13)\n at WebSocketClient.emit (node:events:518:28)\n at WebSocketClient.emit (node:domain:488:12)\n at /app/node_modules/@adiwajshing/baileys/lib/Socket/socket.js:241:35\n at Object.decodeFrame (/app/node_modules/@adiwajshing/baileys/lib/Utils/noise-handler.js:149:17)\n at process.processTicksAndRejections (node:internal/process/task_queues:95:5)"} [05:41:47.534] ERROR (WhatsappSession/49): session:session_03yrw9 - Connection closed due to 'Error: Connection Failure', do not reconnect the session. {"reqId":383,"session":"session_03yrw9","sessionRunTimestamp":1728452505125} [05:41:47.534] INFO (WhatsappSession/49): session:session_03yrw9 - Job stopped {"reqId":383,"session":"session_03yrw9","sessionRunTimestamp":1728452505125,"job":"auto-restart","class":"SinglePeriodicJobRunner"} [05:41:47.534] INFO (WhatsappSession/49): session:session_03yrw9 - Job cancelled {"reqId":383,"session":"session_03yrw9","sessionRunTimestamp":1728452505125,"job":"start-engine","class":"SingleDelayedJobRunner"} [05:41:47.548] DEBUG (WhatsappSession/49): session:session_03yrw9 - NOWEB events {"reqId":383,"session":"session_03yrw9","sessionRunTimestamp":1728452505125,"events":{"connection.update":{"connection":"close","lastDisconnect":{"error":{"data":{"reason":"401","location":"rva"},"isBoom":true,"isServer":false,"output":{"statusCode":401,"payload":{"statusCode":401,"error":"Unauthorized","message":"Connection Failure"},"headers":{}}},"date":"2024-10-09T05:41:47.534Z"}}}}

So what I tried next is removing it and repairing and so far all okay, but if this log can show anything that can help understand what part needs maybe to be tweaked, it's always good to report.. thanks alot!

devlikepro commented 10 hours ago

Hi!

  1. For how long this session has been worked?
  2. Do you use files to store the session, right? like ./.sessions mapping in docker compose

Yeah, shit happens time to time in authentication process.... Consider restarting the server every night to catch such things ASAP and update to 2024.10.4 - we have added few graceful shutdown things there, so restarts go smoother

patron:PRO

yeheskel2016 commented 30 minutes ago

Hi, I think around 2 month (But with some restarts along the way) And yes I do store the files with mapping in the docker compose, I see, unfortunatly my Pro sub is already off so I cant update to the latest, but I will just trigger some more restarts and see if it would return in the future, hopefully I could have more detailed logs that could help you find the root cause but seems nothing really came through ;/