Skip to content

Login fails with 'WebSocket Error (socket hang up)' ECONNRESET #2

@bheemreddy-samsara

Description

@bheemreddy-samsara

Description

warelay login --verbose fails immediately with "WhatsApp Web connection ended before fully opening" without displaying a QR code.

Environment

  • OS: macOS (darwin 24.6.0)
  • Node: v22.21.1 (also tested with v20.19.5)
  • warelay version: 1.1.0
  • Network: No proxy, direct internet connection

Error Details

Running the Baileys connection directly reveals the actual error:

WebSocket Error (socket hang up)
ECONNRESET
statusCode: 408 (Request Time-out)

Full stack trace:

Error: WebSocket Error (socket hang up)
    at WebSocketClient.<anonymous> (.../warelay/node_modules/@whiskeysockets/baileys/lib/Socket/socket.js:879:17)
    at WebSocket.emit (node:events:519:28)
    at emitErrorAndClose (.../ws/lib/websocket.js:1041:13)
    at ClientRequest.<anonymous> (.../ws/lib/websocket.js:881:5)
    at TLSSocket.socketOnEnd (node:_http_client:598:5)

Steps to Reproduce

  1. Install warelay: npm install -g warelay
  2. Run: warelay login --verbose
  3. Connection fails before QR code is displayed

Connection Update Sequence

{"connection": "connecting", "receivedPendingNotifications": false}
{"connection": "close", "lastDisconnect": {"error": {"data": {"code": "ECONNRESET"}, "isBoom": true, "output": {"statusCode": 408, "payload": {"error": "Request Time-out", "message": "WebSocket Error (socket hang up)"}}}}}

Investigation

  • Network connectivity to https://web.whatsapp.com works (returns 307 redirect)
  • No HTTP/HTTPS proxy configured
  • Credentials directory exists but is empty (~/.warelay/credentials/)
  • Issue occurs with both Node 20 and Node 22

Possible Causes

  1. WhatsApp blocking certain IP ranges or ISPs
  2. Baileys library version incompatibility
  3. Corporate network/firewall blocking WebSocket upgrades (though curl works)
  4. Regional WhatsApp server issues

Workaround Attempted

  • Cleared credentials directory
  • Upgraded Node from 20 to 22
  • Reinstalled warelay

None of these resolved the issue.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions