loggly / node-loggly-bulk

A client implementation for Loggly in node.js
https://www.loggly.com/docs/node-js-logs/
Other
20 stars 20 forks source link

Unspecified error from Loggly: SyntaxError: Unexpected token < in JSON at position 0 #17

Closed NickMihaiu91 closed 7 years ago

NickMihaiu91 commented 7 years ago

Hello,

For a few weeks now, we are getting this error. We initially were using the unofficial winston/node-loggly but changed to the oficial one in the hope we get rid of this problem, but it persists.

As you can see in the image the problem originates in the node loggly bulk library. node-loggly-bulk

It seems that we get an error response that is probably HTML and not JSON so it breaks because it can't handle this. Any idea on why this happens?

Thank you, Nick

mostlyjason commented 7 years ago

Thanks for reporting this! You're probably right that the error response is HTML. We'd have to check to see if we are handling the errors correctly. I have added this to our backlog, but there are a few other projects ahead of this one in the queue. Let us know if you get a fix before we get a chance.

NickMihaiu91 commented 7 years ago

Thank you for the reply @mostlyjason . Could you please tell me what priority would this have and if you can give any estimate on when you'll a chance to look into this?

mostlyjason commented 7 years ago

That's a good question. How is this error message affecting you? Is it causing the application to stop or does it merely log an error and then continue?

NickMihaiu91 commented 7 years ago

It's not causing our application to stop since we catch and treat the error, but this would happen when sending a log to Loggly so we're losing data and since we don't have the initial stack we're not aware of what logs are we losing.So there might be errors that are hidden because of this.

mostlyjason commented 7 years ago

FYI Winston offers a continuation function that allows you to recover when there is an error https://github.com/loggly/winston-loggly-bulk/pull/4. I haven't looked at this library recently for not sure if we offer it. Nevertheless, I think the better solution here is to fix this problem so that the library will automatically retry. I'm hoping to get this in our Sprint within the next few weeks.

NickMihaiu91 commented 7 years ago

Thanks for pointing that out @mostlyjason, but indeed the actual solution would be that the library will automatically retry. Please let me know when you get to work on this if I can help you with some more data or in any other way. Thank you!

mostlyjason commented 7 years ago

Addressed in 2.1.0 please reopen if it keeps happening after updating.