Skip to content
Latchkey

LaunchDarkly "Error on stream connection" network failure in CI

The LaunchDarkly SDK failed to open or keep its Server-Sent Events stream to stream.launchdarkly.com and logs a network error before retrying. Unlike a 401, this is a connectivity problem: the endpoint is unreachable or an intercepting proxy broke the long-lived connection.

What this error means

LaunchDarkly logs "Error on stream connection: <network error>, will retry" repeatedly. On restricted runners the stream never establishes and the client stays on cached or default values.

LaunchDarkly
[LaunchDarkly] ERROR: Error on stream connection: getaddrinfo ENOTFOUND
stream.launchdarkly.com, will retry in 1 second

Common causes

Egress or DNS to the streaming host is blocked

A restricted CI network cannot resolve or reach stream.launchdarkly.com, so the SSE connection never opens.

A proxy terminates the long-lived SSE stream

A corporate proxy that buffers or closes idle connections breaks the streaming transport the SDK relies on.

How to fix it

Allow egress or configure the proxy

  1. Allow the runner to reach stream.launchdarkly.com and clientstream.launchdarkly.com on 443.
  2. If a proxy is required, set HTTPS_PROXY and pass proxy options to the SDK.
  3. Confirm DNS resolves the LaunchDarkly hosts from the runner.
.github/workflows/ci.yml
env:
  HTTPS_PROXY: http://proxy.internal:8080

Switch to polling where streaming is blocked

If the SSE stream cannot pass the network, use polling mode so the SDK fetches flags over plain HTTPS requests.

init.js
const client = LaunchDarkly.init(sdkKey, { stream: false });

How to prevent it

  • Allowlist the LaunchDarkly streaming and polling hosts on CI networks.
  • Use polling mode on runners behind proxies that break SSE.
  • Verify DNS resolution of LaunchDarkly hosts as part of runner setup.

Related guides

Tired of flaky CI? Latchkey auto-heals failed jobs and retries them for you. Start free →