launchdarkly / node-server-sdk

LaunchDarkly Server-side SDK for Node
Other
79 stars 65 forks source link

httpErrorMessage not properly stringified #263

Closed Pipo93 closed 5 months ago

Pipo93 commented 1 year ago

Describe the bug We received more than 100 warning logs today where it is impossible to detect the actual root cause for the error: ["2022-11-09T03:40:00.141Z"] Received I/O error ([object Object]) for streaming request - will retry.

Looks like in https://github.com/launchdarkly/node-server-sdk/blob/main/messages.js#L10 the error object is not properly stringified.

To reproduce It is hard to reproduce on our side but it should be possible by calling httpErrorMessage with an error object not containing a message.

Expected behavior The actual error is properly logged to the warning message.

Logs ["2022-11-09T03:40:00.141Z"] Received I/O error ([object Object]) for streaming request - will retry

SDK version 6.4.3

Language version, developer tools node v16.14.2

OS/platform Docker node16 image

kinyoklion commented 1 year ago

Hello @Pipo93,

Thank you for raising this issue.

We will look into how we are getting an error without a status or a message. I would be hesitant to stringify it though.

Filed internally as 176346

Thanks, Ryan

kinyoklion commented 1 year ago

Hey @Pipo93,

It looks like this will only happen when the underlying request either completes, or closes prematurely, but there is no error. In this case the event source raises an 'end' event, which doesn't have a message, and the node server doesn't handle that correctly. I will provide another update once we have released a fix.

Thanks, Ryan

praxxis commented 1 year ago

We can reproduce this by connecting to an ld-relay implementation in streaming mode, when the relay has a maxClientConnectionTime set. It kills the connection every ~5 minutes, causing Received I/O error ([object Object]) for streaming request - will retry to be logged as a warning.

kinyoklion commented 5 months ago

This is fixed in @launchdarkly/node-server-sdk version 9.4.1.