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] ERROR: Error on stream connection: getaddrinfo ENOTFOUND
stream.launchdarkly.com, will retry in 1 secondCommon 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
- Allow the runner to reach stream.launchdarkly.com and clientstream.launchdarkly.com on 443.
- If a proxy is required, set HTTPS_PROXY and pass proxy options to the SDK.
- Confirm DNS resolves the LaunchDarkly hosts from the runner.
env:
HTTPS_PROXY: http://proxy.internal:8080Switch 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.
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.