Skip to content

:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.

fix(ingestion): fail startup when event filters cannot load (#122145)

Paweł Ledwoń33c45a3f41bd
diff --git a/nodejs/src/ingestion/common/event-filters/manager.test.ts b/nodejs/src/ingestion/common/event-filters/manager.test.ts
index fc8149addc3d..f5931a8c6912 100644
--- a/nodejs/src/ingestion/common/event-filters/manager.test.ts
+++ b/nodejs/src/ingestion/common/event-filters/manager.test.ts
@@ -143,6 +143,12 @@ describe('EventFilterManager', () => {
await stop()
})
+ it('fails to start when the first load fails', async () => {
+ mockPostgres.query.mockRejectedValue(new Error('connection refused'))
+
+ await expect(buildManager()).rejects.toThrow('connection refused')
+ })
+
it('keeps the loaded filters when a background reload fails', async () => {
mockPostgres.query.mockResolvedValueOnce({
rows: [
diff --git a/nodejs/src/ingestion/common/event-filters/manager.ts b/nodejs/src/ingestion/common/event-filters/manager.ts
index df2e1473dacd..c75a98e07f3c 100644
--- a/nodejs/src/ingestion/common/event-filters/manager.ts
+++ b/nodejs/src/ingestion/common/event-filters/manager.ts
@@ -31,11 +31,9 @@ export class EventFilterManager {
}
async prime(): Promise<void> {
- // Failures are logged but don't surface — `tryGet` will retry in the
- // background on subsequent reads.
- await this.refresher.get().catch((error) => {
- logger.error('Failed to initialize event filter config', { error })
- })
+ // Do not catch a first load error: startup must fail. A consumer without its filters
+ // ingests the events that a filter drops, and those events cannot be removed later.
+ await this.refresher.get()
}
/** Returns the filter for a team, or null if disabled or has no conditions. Non-blocking. */