Closed yelworc closed 10 months ago
Hi @yelworc , I tried to repro the issue but no luck. Which version of Moment.js package were you using? Also, I am wondering were you able to add default callback in the logger for error handling? https://github.com/googleapis/nodejs-logging-bunyan#error-handling-with-a-default-callback
@cindy-peng thanks for looking into this!
I'm afraid I cannot reproduce this anymore, either; not even after rolling back to the code state around the time of reporting (the moment.js version was and still is 2.29.4). Maybe I misdiagnosed the cause 🤔
Either way, feel free to close the issue – I'll reopen if I come across it again.
Sounds good. Thanks @yelworc! I am closing this for now but feel free to reopen it if this happens again. 😊
When logging a message with some object in the payload data that cannot be serialized to protobuf, a Node.js warning is logged on the console, and no further messages are written to the Cloud Logging stream. A while later, the default callback handler is called with the following error:
Error: Total timeout of API google.logging.v2.LoggingServiceV2 exceeded 60000 milliseconds before any response was received.
The prior warning looks roughly like this (with
node --trace-warnings
; abbreviated because the actual payload is quite big):So, obviously I should avoid throwing non-trivial objects into log messages, but is the behavior of the library correct/expected in this case? Specifically:
Intuitively, I would say the lib should probably drop individual problematic messages (and report the serialization problem via the callback handler), rather than stop working entirely. At the very least, the current error message is misleading, since it suggests some sort of networking issue.
If this is a more general issue with nodejs-logging, let me know, and I'll close this one and reopen the issue over there.
Environment details
@google-cloud/logging-bunyan
version: 4.2.2Steps to reproduce
The specific object that causes an error when serializing to protobuf is a Moment.js instance, i.e. something like this should reproduce the problem: