Skip to content
This repository was archived by the owner on May 30, 2024. It is now read-only.
This repository was archived by the owner on May 30, 2024. It is now read-only.

Retriable HTTP errors are treated as fatal errors #155

Description

@jkehres

I'm using version 5.7.4 of the SDK and I have code like this inside an async function:

constld=require('ldclient-node');constldClient=ld.init(sdkKey);awaitldClient.waitForInitialization();constvalue=awaitldClient.variation(...);

Every once in a great while I get a rejected promise from the function with an error like this:

{
"message": "Received error 502 for streaming connection - will retry",
"name": "LaunchDarklyStreamingError",
"stack": [
"LaunchDarklyStreamingError: Received error 502 for streaming connection - will retry",
" at EventSource.es.onerror (\/var\/task\/node_modules\/ldclient-node\/streaming.js:26:10)",
" at emitOne (events.js:116:13)",
" at EventSource.emit (events.js:211:7)",
" at _emit (\/var\/task\/node_modules\/ldclient-node\/eventsource.js:191:17)",
" at ClientRequest.<anonymous> (\/var\/task\/node_modules\/ldclient-node\/eventsource.js:110:9)",
" at Object.onceWrapper (events.js:315:30)",
" at emitOne (events.js:116:13)",
" at ClientRequest.emit (events.js:211:7)",
" at HTTPParser.parserOnIncomingClient (_http_client.js:519:21)",
" at HTTPParser.parserOnHeadersComplete (_http_common.js:115:23)"
]
}

If the client is going to retry, why does it return a fatal error? I would expect it to silently retry with exponential backoff instead and only emit a fatal error after exceeding a maximum number of retries.

The error appears to originate here:

message: messages.httpErrorMessage(res.statusCode,'streaming connection','will retry'),

and a few lines later there appears to be some code that will do a retry with backoff but it's not working for my use case - presumably because the error event is immediately turned into a fatal error that terminates the client.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions