OpenPanel is an open-source web and product analytics platform, an open-source alternative to Mixpanel with optional self-hosting.
fix(worker): don't crash the worker when /metrics collection fails (#498)
ayushjhanwar-pngc0aac43686b3
diff --git a/apps/worker/src/index.ts b/apps/worker/src/index.tsindex 23eac47f5..8983e838d 100644--- a/apps/worker/src/index.ts+++ b/apps/worker/src/index.ts@@ -54,7 +54,11 @@ async function start() {res.end(metrics);}).catch((error) => {- res.status(500).end(error);+ // res.end() only accepts a string/Buffer; passing a raw Error object+ // throws a TypeError inside this catch, which is unhandled and crashes+ // the worker. Since /metrics is scraped on every pod, one failing+ // collector can take down the whole fleet. Stringify to be safe.+ res.status(500).end(String(error?.message ?? error));});});