fix(whatsapp): honor proxy env vars during pairing - #43659
Closed
konsisumer wants to merge 1 commit into
Closed
Conversation
Collaborator
Contributor
Author
|
Closing — this PR was labeled |
Collaborator
|
Closing in favour of #43822 (kyssta-exe), which the team is using as the canonical proxy implementation for this feature cluster. Why #43822 was preferred over this PR:
The Thank you for the thorough implementation — the modular approach would make more sense if proxy config gained more complexity down the road! 🙏 |
13 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this PR do?
Teach the WhatsApp bridge to honor standard
HTTPS_PROXY/HTTP_PROXYenvironment variables when Baileys opens its WebSocket connection. In proxied environments this lets pairing reach the QR-code step instead of looping on disconnect reason 408 before the bridge is usable.Related Issue
Fixes #43603
Type of Change
Changes Made
scripts/whatsapp-bridge/bridge.js: pass proxy-derived socket options intomakeWASocket()so Baileys uses proxy env vars during pairing and reconnect.scripts/whatsapp-bridge/proxy.js: add a narrow helper that resolvesHTTPS_PROXY/https_proxybeforeHTTP_PROXY/http_proxyand lazily constructs the proxy agent.scripts/whatsapp-bridge/proxy.test.mjs: cover proxy env precedence and agent wiring without needing a live WhatsApp session.scripts/whatsapp-bridge/package.json: add the directhttps-proxy-agentdependency the bridge now uses at runtime.scripts/whatsapp-bridge/package-lock.json: lock the new bridge dependency and its transitive packages for repo-local installs.How to Test
npm install --prefix scripts/whatsapp-bridge.node --test scripts/whatsapp-bridge/allowlist.test.mjs scripts/whatsapp-bridge/proxy.test.mjs.HTTPS_PROXY=http://proxy.example:3128(or one of the lowercase / HTTP variants) and start the WhatsApp pairing flow; verify it reaches the QR-code step instead of repeatingConnection closed (reason: 408). Reconnecting in 3s..../opt/homebrew/bin/timeout -k 30 480 sh -c 'pytest tests/ -q -x --timeout=60 "$@"' shto exercise the repo test suite. In my local shared environment this aborted during collection becausefastapiis missing (tests/hermes_cli/test_dashboard_auth_401_reauth.py), so CI or a fully provisioned local env should cover the Python suite.What platforms tested on
darwin-arm64v26.0.0for the bridge regression testsChecklist
Code
fix(scope):,feat(scope):, etc.)pytest tests/ -qand all tests passdarwin-arm64, Node.jsv26.0.0Documentation & Housekeeping
docs/, docstrings) — or N/Acli-config.yaml.exampleif I added/changed config keys — or N/ACONTRIBUTING.mdorAGENTS.mdif I changed architecture or workflows — or N/AScreenshots / Logs
node --test scripts/whatsapp-bridge/allowlist.test.mjs scripts/whatsapp-bridge/proxy.test.mjspassed locally.ModuleNotFoundError: No module named 'fastapi'intests/hermes_cli/test_dashboard_auth_401_reauth.pybefore it reached any WhatsApp bridge code.