diff --git a/scripts/start-services.sh b/scripts/start-services.sh index 303caf696..797052049 100755 --- a/scripts/start-services.sh +++ b/scripts/start-services.sh @@ -132,6 +132,15 @@ do_start() { command -v node >/dev/null || fail "node not found. Install Node.js first." + # WSL2 ships with broken IPv6 routing. Node.js resolves dual-stack DNS results + # and tries IPv6 first (ENETUNREACH) then IPv4 (ETIMEDOUT), causing bridge + # connections to api.telegram.org and gateway.discord.gg to fail from the host. + # Force IPv4-first DNS result ordering for all bridge Node.js processes. + if [ -n "${WSL_DISTRO_NAME:-}" ] || [ -n "${WSL_INTEROP:-}" ] || grep -qi microsoft /proc/version 2>/dev/null; then + export NODE_OPTIONS="${NODE_OPTIONS:+$NODE_OPTIONS }--dns-result-order=ipv4first" + info "WSL2 detected — setting --dns-result-order=ipv4first for Node.js bridge processes" + fi + # Verify sandbox is running if command -v openshell >/dev/null 2>&1; then if ! openshell sandbox list 2>&1 | grep -q "Ready"; then