Skip to content

Comments

fix: use MACOS platform to resolve 405 Connection Failure#2365

Open
kobie3717 wants to merge 1 commit intoWhiskeySockets:masterfrom
kobie3717:fix/405-platform-macos
Open

fix: use MACOS platform to resolve 405 Connection Failure#2365
kobie3717 wants to merge 1 commit intoWhiskeySockets:masterfrom
kobie3717:fix/405-platform-macos

Conversation

@kobie3717
Copy link

Fix for 405 Connection Failure (Issue #2364)

This PR resolves the 405 Connection Failure affecting ALL new Baileys connections globally as of 2026-02-24.

Root Cause

WhatsApp servers have started rejecting the UserAgent.Platform.WEB (value 14) and now require MACOS (value 24) for new device pairing. The noise handshake succeeds, but WhatsApp then sends <failure reason='405' location='xxx'/> due to client payload validation failure.

Solution

Changed platform: proto.ClientPayload.UserAgent.Platform.WEB to platform: proto.ClientPayload.UserAgent.Platform.MACOS in src/Utils/validate-connection.ts.

This aligns with WhatsApp Web's current behavior, which now identifies itself as MACOS platform rather than WEB.

Impact

  • ✅ Fixes QR code generation for new device pairing
  • ✅ Does not affect existing authenticated sessions
  • ✅ Minimal code change with maximum compatibility

Testing

Confirmed that QR codes generate successfully after this change, resolving the global connection issues reported in issue #2364.

Closes #2364

@whiskeysockets-bot
Copy link
Contributor

Thanks for opening this pull request and contributing to the project!

The next step is for the maintainers to review your changes. If everything looks good, it will be approved and merged into the main branch.

In the meantime, anyone in the community is encouraged to test this pull request and provide feedback.

✅ How to confirm it works

If you’ve tested this PR, please comment below with:

Tested and working ✅

This helps us speed up the review and merge process.

📦 To test this PR locally:

# NPM
npm install @whiskeysockets/baileys@kobie3717/Baileys#fix/405-platform-macos

# Yarn (v2+)
yarn add @whiskeysockets/baileys@kobie3717/Baileys#fix/405-platform-macos

# PNPM
pnpm add @whiskeysockets/baileys@kobie3717/Baileys#fix/405-platform-macos

If you encounter any issues or have feedback, feel free to comment as well.

@ayocodingit
Copy link

nice 👍

@ayocodingit
Copy link

woah tested from local me :)

thanks @kobie3717

@mfcarroll
Copy link

Tested and working ✅

@salemsayed
Copy link

confirmed working locally, you’re the hero

@mfeifei1199
Copy link

Tested and working ✅

@sgbtz
Copy link

sgbtz commented Feb 24, 2026

Tested and working ✅

2 similar comments
@ellivelton-narciso
Copy link

Tested and working ✅

@devbleras
Copy link

Tested and working ✅

@ayocodingit
Copy link

I hope as soon to merged 🙏

@uitgaansideeen
Copy link

It worked.

@uitgaansideeen
Copy link

Tested and working ✅

@AadityaChoubey68
Copy link

Tested and Working ✅

@devrhapp
Copy link

Fiz exatamente como orientado na PR mudei o platafroma para MACOS , estou no local dev e deu este error o que acontecde muito em producao e dev.

meu logs WARN [09:19:15.990] (6661) <EventEmitter. (file:///Users/devrhapp/Documents/intra-connect-saas/whaticket/backend/src/libs/wbot.ts:1:10574)>:
message: "Connection closed with error"
companyId: 1
errorMessage: "Connection Terminated"
statusCode: 428
sessionName: "dev"

{"level":30,"time":"2026-02-24T12:09:24.420Z","pid":5454,"hostname":"Mac-mini-de-Dev.local","trace":"Error: WebSocket Error (connect ETIMEDOUT 57.144.165.32:443)\n at WebSocketClient. (file:///Users/devrhapp/Documents/intra-connect-saas/whaticket/backend/node_modules/baileys/src/Socket/socket.ts:1070:11)\n at WebSocketClient.emit (node:events:526:35)\n at WebSocket. (file:///Users/devrhapp/Documents/intra-connect-saas/whaticket/backend/node_modules/baileys/src/Socket/Client/websocket.ts:39:52)\n at WebSocket.emit (node:events:514:28)\n at emitErrorAndClose (/Users/devrhapp/Documents/intra-connect-saas/whaticket/backend/node_modules/ws/lib/websocket.js:1046:13)\n at ClientRequest. (/Users/devrhapp/Documents/intra-connect-saas/whaticket/backend/node_modules/ws/lib/websocket.js:886:5)\n at ClientRequest.emit (node:events:514:28)\n at TLSSocket.socketErrorListener (node:_http_client:495:9)\n at TLSSocket.emit (node:events:514:28)\n at emitErrorNT (node:internal/streams/destroy:151:8)","msg":"connection errored"}
Error: connect ETIMEDOUT 57.144.165.32:443
at __node_internal_captureLargerStackTrace (node:internal/errors:497:5)
at __node_internal_exceptionWithHostPort (node:internal/errors:672:12)
at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1595:16)
at TCPConnectWrap.callbackTrampoline (node:internal/async_hooks:130:17) {
errno: -60,
code: 'ETIMEDOUT',
syscall: 'connect',
address: '57.144.165.32',
port: 443
}
Error: connect ETIMEDOUT 57.144.165.32:443
at __node_internal_captureLargerStackTrace (node:internal/errors:497:5)
at __node_internal_exceptionWithHostPort (node:internal/errors:672:12)
at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1595:16)
at TCPConnectWrap.callbackTrampoline (node:internal/async_hooks:130:17) {
errno: -60,
code: 'ETIMEDOUT',
syscall: 'connect',
address: '57.144.165.32',
port: 443
}

@kobie3717
Copy link
Author

@devrhapp Your issue is different from the 405 fix in this PR. You have two separate problems:

1. Status 428 (Precondition Required)
This means WhatsApp is requesting you to re-authenticate or update session preconditions. This usually happens when:

  • Your auth state is stale/corrupted — try deleting your auth folder and scanning QR fresh
  • Your session was connected on another instance simultaneously (multi-device conflict)

2. ETIMEDOUT to 57.144.165.32:443
Your machine cannot reach the WhatsApp WebSocket server at that IP. This is a network-level issue:

  • Check if your ISP or firewall is blocking outbound connections to WhatsApp servers
  • Try: curl -v https://web.whatsapp.com from your Mac Mini to verify connectivity
  • If that times out too, your IP range may be throttled/blocked by WhatsApp. Try routing through a different network or VPN temporarily to confirm
  • Some Brazilian hosting providers have been reported as blocked — if this is on a cloud server, try a different provider/region

Suggested steps:

  1. Delete your auth/session folder completely
  2. Test network: curl -I https://web.whatsapp.com — should return 200
  3. If curl fails, the issue is network/IP, not Baileys
  4. If curl works but Baileys still fails, make sure you applied the MACOS platform fix correctly and share your Baileys version

Hope this helps!

heroncosmo added a commit to heroncosmo/vvvv that referenced this pull request Feb 24, 2026
- WhatsApp passou a rejeitar Platform.WEB (value 14) em 2026-02-24
- Adiciona version: [2, 3000, 1033893291] em TODOS os 4 makeWASocket calls
- Cria patch-baileys-platform.mjs para trocar Platform.WEB -> MACOS
- Integra patch no build script (roda antes do vite build)
- Remove fetchLatestBaileysVersion() no pairing (versao fixa)
- Ref: WhiskeySockets/Baileys#2370
- Ref: WhiskeySockets/Baileys#2365
@LuthfanHadi
Copy link

Tested and Working ✅

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Connection Failure (Object.decodeFrame) Loop during Pairing Code / Auth