Skip to content

fix(provider-sherpa): resolve the WA version automatically and recover from 405 - #1298

Merged
leifermendez merged 2 commits into
builderbotfrom
fix/sherpa-wa-version-resolution
Nov 18, 2026
Merged

leifermendez merged 2 commits into
builderbotfrom
fix/sherpa-wa-version-resolution

Conversation

@leifermendez

Copy link
Copy Markdown
Member

Problem

@builderbot/provider-sherpa fails with 405 Connection Failure / ERRO AUTH, same root cause as #1296 for Baileys:

  • The hardcoded fallback 2.3000.1023223821 and the version passed by the sherpa templates 2.3000.1034028152 are rejected by WhatsApp.
  • The version bundled with whaileys@6.3.8 itself (2.3000.1028340218) is rejected too.
  • ...this.globalVendorArgs was spread after version, so the raw option always won.
  • A 405 was not handled: it ended in a generic "Critical connection error".

Live probe with whaileys@6.3.8 (fresh auth, provider browser descriptor), 2026-11-18:

Version Result
2.3000.1023223821 (provider fallback) 405
2.3000.1034028152 (templates) 405
2.3000.1028340218 (whaileys bundled) 405
2.3000.1043857760 (whaileys repo / new fallback) QR issued
2.3000.1055185710 (live WhatsApp Web) QR issued

Fix

Mirrors #1296 (independent of it, no shared code between packages):

  • New src/waVersion.ts: resolves the version on every connection — WA_VERSION / version option → whaileys-recommended (fetchLatestBaileysVersion, reads canove/whaileys master) → live WhatsApp Web (fetchLatestWaWebVersion) → fallback 2.3000.1043857760. 5 s timeout per lookup.
  • version accepts the text copied from wppconnect.io ('2.3000.1054953954-alpha') as well as arrays.
  • version now goes after the spread, so resolution and recovery always apply.
  • On 405: reconnect with the live WhatsApp Web version, skipping the manual one, up to 3 times; then auth_failure explaining the manual fix (wppconnect.io + WA_VERSION).
  • Templates: the 12 sherpa starters drop the stale pinned version and document the manual fix (regenerated with pnpm run generate.templates).
  • README: new "WhatsApp Web version" section.

Verification

  • pnpm --filter @builderbot/provider-sherpa test: 95 passed (new waVersion.test.ts + #WA version provider tests: auto, wppconnect text, WA_VERSION precedence, 405 recovery, 405 limit). The whaileys mock now exposes the default socket factory, so initVendor tests reach socket creation.
  • Build OK.
  • Live end-to-end with the built bundle: new SherpaProvider({ version: [2, 3000, 1034028152] }) →
[Sherpa] Using WA Web version 2.3000.1034028152 (source: manual)
Connection closed. Status: 405, Reason: Connection Failure
WA version 2.3000.1034028152 rejected (405); retrying with the live WhatsApp Web version
[Sherpa] Using WA Web version 2.3000.1055185710 (source: wa-web)
→ QR issued

Notes

  • whaileys 6.5.1 is available on npm (we pin 6.3.8); upgrading is out of scope here.

leifermendez and others added 2 commits November 18, 2026 19:10
…r from 405

The hardcoded fallback (2.3000.1023223821) and the version passed by the
templates (2.3000.1034028152) are both rejected by WhatsApp with
405 Connection Failure, and so is the version bundled with whaileys 6.3.8.
The raw `version` option was also spread after `version`, so it always won.

- Resolve the version on every connection: WA_VERSION / `version` option,
  then the whaileys-recommended version, then the live WhatsApp Web
  version, then a fallback verified against WhatsApp (2.3000.1043857760).
- Accept the text copied from wppconnect.io ('2.3000.1054953954-alpha').
- On 405, reconnect with the live WhatsApp Web version (up to 3 times),
  then emit auth_failure explaining the manual fix.

Co-authored-by: Cursor <cursoragent@cursor.com>
@leifermendez
leifermendez merged commit b72dbf6 into builderbot Nov 18, 2026
2 checks passed
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.

1 participant