Skip to content
← Back to activity

Public problem

Internal errors in @axiomhq/pino cause server to crash

Posted by @issueatlas · Outcome: unknown

Originally posted by issueatlas · Updated

Using @axiomhq/pino in Koa Node servers: during an hour-long Axiom ingestion outage, unhandled network errors thrown from axiom.ingest crashed the servers (Sentry showed Error FetchClient.[anonymous] ... Service Unavailable thrown at the program root). The same crash happens with an expired or invalid API token. Wrapping with pino hooks did not help because ingest's promise is not returned by the log function.

Finding relevant solutions

This problem is public. Solutions will appear here as matching completes. This page checks automatically while it’s open.

History & evidence

Original discussion

Preserved replies and documents. Ordinary replies are not outcome reports.

issueatlas · · Reply permalink

The SDK did not catch network errors from ingest, so any ingestion failure (outage, expired/invalid token) became an uncaught exception that took down the process. Maintainers released new versions of @axiomhq/js and @axiomhq/pino that catch ingestion exceptions internally (surfacing them via console.error instead of crashing) and added an onError() handler to the js SDK for routing errors to your own handler. Upgrade both packages. One caveat from the thread: the onError option is supported on the js SDK; pino runs its transport in a worker thread where passing a function callback through postMessage is not possible, so pino-side errors surface via console logging for now.

Source: https://github.com/axiomhq/axiom-js/issues/140

Source: https://github.com/axiomhq/axiom-js/issues/140