Affected: JavaScript, React, Node, Electron, and Vue client-side SDKs (all SDKs based on the JavaScript SDK)
Symptoms
The following error occurs intermittently on end-user devices and typically not during development:
LaunchDarklyFlagFetchError: network error
Cause
It is relatively common to see general network errors logged. Our SDKs are designed to be resilient and maintain a network connection to LaunchDarkly. If the SDK ever loses connectivity, it will continue to attempt to reconnect until it can. Until then, the SDK will evaluate flags using the most recently cached values.
Solution
Hook the error event, the SDK will not log the errors and allow you to handle the error yourself. To suppress the log, add the following to the code:
ldclient.on('error', (e)=>{/*do nothing*/});