-
Notifications
You must be signed in to change notification settings - Fork 66
Retriable HTTP errors are treated as fatal errors #155
Comments
When you say "a fatal error that terminates the client", could you be more specific about a few things:
I do think this is unintended behavior, but I just want to understand the circumstances better. |
|
Thanks, we'll look into this. |
I think I'm experiencing similar issue.
I could reproduce by disconnecting wifi locally to generate error I tried catching the promise error by
but code still blows up unexpected. After hours, I realizsed that in order to fail / catch gracefully I must place the
So a simple example would be able to demonstrate, copy / paste below snippets into the demo window on https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise/then
And
And after browsing https://github.com/launchdarkly/node-server-sdk/blob/master/index.js#L161
Would love some feedback from the author and any potential updates to fix this weird behavior. |
@HistoricallyCorrect I'm not sure I completely understand your point. I have two thoughts:
In my experience, that is not how Promise works. If Assuming the But, again, this is not anything specific to the SDK; it's just about how Promise works. I'm not sure what is going on in your code, but there is no way for the SDK to throw some kind of special error that would not be caught by |
@eli-darkly Thanks for the reply. I can start a new issue if you think the issue I'm reporting is totally unrelated to the original reported issue. But the error I'm getting is also I think the issue I'm reporting is due to the use of streaming from SDK, when connection is unstable or reconnecting, from within the SDK which will cause exception from There's nothing funny going on in my code. I've pasted all the code I have, except the inner bit of If you say that I can only put |
@HistoricallyCorrect I understand that the general error message is the same, but you are definitely reporting a different issue, since the original reporter did not say anything about the Again, I'm not sure how a Promise can behave the way you're saying it is behaving— that is, calling your |
Fixed in the 5.9.2 release (fixed the original issue, that is - not the other discussion threads here). |
I'm using version 5.7.4 of the SDK and I have code like this inside an async function:
Every once in a great while I get a rejected promise from the function with an error like this:
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:
node-server-sdk/eventsource.js
Line 114 in a770805
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.
The text was updated successfully, but these errors were encountered: