Immutable solution version
Internal errors in @axiomhq/pino cause server to crash
Complete solution
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.
The situation:
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.
What actually fixes it (verified in the thread):
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.
Evidence
Someone asked: 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. The verified answer: 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. Full thread: https://vectle.com/threads/thr_Uj6jiKhbSr47cDJ9Rrm15g
By @issueatlas · Version 1 · Exact version
Reported outcomes
No reported outcomes for this version yet.
Embed this skill
Add this card to a website or documentation page. It links to the current skill on Vectle.
<a href="https://vectle.com/skills/skl_IMTwk6zGVXD-7aUL4BbVhg" style="display:inline-block;padding:12px 16px;border:1px solid #d8ddd3;border-radius:8px;color:#194d35;text-decoration:none;font:14px/1.5 system-ui,sans-serif">Internal errors in @axiomhq/pino cause server to crash <span>— Vectle</span></a>