#Baileys.js ws returns `Connection Terminated`

1 messages · Page 1 of 1 (latest)

eternal olive
#

im trying to build a whatsapp bot using https://github.com/WhiskeySockets/Baileys but kept getting WS errors.

[bun] Warning: ws.WebSocket 'upgrade' event is not implemented in bun
[bun] Warning: ws.WebSocket 'unexpected-response' event is not implemented in bun

{"level":30,"time":"2023-09-13T16:06:13.177Z","pid":439,"hostname":"DESKTOP-JEUKCK6","class":"baileys","browser":["Baileys","Chrome","4.0.0"],"helloMsg":{"clientHello":{"ephemeral":"HbtkwwQTDiZ5r/X0F2DacmaZ/9Z0Myc+xR26a3x4YA=="}},"msg":"connected to WA"}

{"level":30,"time":"2023-09-13T16:06:13.445Z","pid":439,"hostname":"DESKTOP-JEUKCK6","class":"baileys","trace":"Error: Connection Terminated\n    at <anonymous> (/mnt/d/Projects/WHAW-BEB/node_modules/@hapi/boom/lib/index.js:80:8)\n    at <anonymous> (/mnt/d/Projects/WHAW-BEB/node_modules/@whiskeysockets/baileys/src/Socket/socket.ts:564:25)\n    at emit (native)\n    at emit (native)\n    at <anonymous> (native)","msg":"connection errored"}

{"level":50,"time":"2023-09-13T16:06:13.446Z","pid":439,"hostname":"DESKTOP-JEUKCK6","class":"baileys","err":{"type":"Error","message":"WebSocket Error (undefined)","stack":"Error: WebSocket Error (undefined)\n    at <anonymous> (/mnt/d/Projects/WHAW-BEB/node_modules/@hapi/boom/lib/index.js:80:8)\n    at <anonymous> (/mnt/d/Projects/WHAW-BEB/node_modules/@whiskeysockets/baileys/src/Socket/socket.ts:737:2)\n    at emit (native)\n    at emit (native)\n    at <anonymous> (native)","data":1006,"isBoom":true,"isServer":true,"output":{"statusCode":500,"payload":{"statusCode":500,"error":"Internal Server Error","message":"An internal server error occurred"},"headers":{}}},"msg":"error in validating connection"}

my config for the socket creation

this.socket = makeWASocket({
  version,
  printQRInTerminal: true,
  // mobile: true,
  auth: {
    creds: state.creds,
    // @ts-ignore
    keys: makeCacheableSignalKeyStore(state.keys, this.app.logger),
  },
});
GitHub

Lightweight full-featured typescript/javascript WhatsApp Web API - GitHub - WhiskeySockets/Baileys: Lightweight full-featured typescript/javascript WhatsApp Web API

digital timberBOT
eternal olive
#

@outer pike is there any workarounds or fallback to the node library instead?

brave seal
#

Having some socket issues too, trying to connect to SurrealDB. @covert acorn got any workarounds while we wait for Bun to pass the Autobahn tests?

hoary vessel
#

up got same issues. @eternal olive do u solve this?