node-server-sdk icon indicating copy to clipboard operation
node-server-sdk copied to clipboard

httpErrorMessage not properly stringified

Open Pipo93 opened this issue 3 years ago • 3 comments
trafficstars

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

Pipo93 avatar Nov 09 '22 09:11 Pipo93

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 avatar Nov 10 '22 17:11 kinyoklion

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

kinyoklion avatar Dec 09 '22 17:12 kinyoklion

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.

praxxis avatar Jul 24 '23 20:07 praxxis

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

  • The js-eventsource has been updated to report a message in the case of an unexpected disconnect.
  • The server has been updated to use the corresponding version.
  • If there is no message a default message is now shown instead of logging the object.

kinyoklion avatar Apr 29 '24 20:04 kinyoklion