: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.
Python ab-testingai-analyticsanalyticscdpdata-warehouseexperimentsfeature-flagsjavascriptproduct-analyticspythonreactsession-replaysurveystypescriptweb-analytics
fix(cdp): retry dependency outages while building inputs instead of parking the event (#115892)
Meikel Ratza96ccc1d55e2
diff --git a/nodejs/src/cdp/utils/invocation-utils.test.ts b/nodejs/src/cdp/utils/invocation-utils.test.tsindex 473f1708ac48..6cf097428a72 100644--- a/nodejs/src/cdp/utils/invocation-utils.test.ts+++ b/nodejs/src/cdp/utils/invocation-utils.test.ts@@ -1,6 +1,8 @@import { DateTime } from 'luxon'import { register } from 'prom-client'+import { DependencyUnavailableError } from '~/common/utils/db/error'+import { HOG_EXAMPLES, HOG_FILTERS_EXAMPLES, HOG_INPUTS_EXAMPLES } from '../_tests/examples'import { createHogExecutionGlobals, createHogFunction } from '../_tests/fixtures'import { HogInputsService } from '../services/hog-inputs.service'@@ -350,6 +352,23 @@ describe('Invocation utils', () => {expect(logs[0].message).toContain('(truncated)')jest.restoreAllMocks()})++ it('rethrows a dependency outage instead of reporting it as an inputs failure', async () => {+ const fn = createHogFunction({+ ...HOG_EXAMPLES.simple_fetch,+ ...HOG_INPUTS_EXAMPLES.simple_fetch,+ ...HOG_FILTERS_EXAMPLES.no_filters,+ })+ const outage = new DependencyUnavailableError(+ 'connect ECONNREFUSED',+ 'Postgres',+ new Error('connect ECONNREFUSED')+ )+ jest.spyOn(hogInputsService, 'buildInputsWithGlobals').mockRejectedValue(outage)++ await expect(buildHogFunctionInvocations(hogInputsService, [fn], pageviewGlobals())).rejects.toBe(outage)+ jest.restoreAllMocks()+ })})describe('cloneInvocation', () => {diff --git a/nodejs/src/cdp/utils/invocation-utils.ts b/nodejs/src/cdp/utils/invocation-utils.tsindex ca8abcb91ffc..8f6bb9e422aa 100644--- a/nodejs/src/cdp/utils/invocation-utils.ts+++ b/nodejs/src/cdp/utils/invocation-utils.ts@@ -122,6 +122,11 @@ export async function buildHogFunctionInvocations(return createInvocation(globalsWithInputs, hogFunction)} catch (error) {+ // A dependency outage, such as Postgres refusing an integration lookup, is not this+ // function's fault. Rethrowing fails the batch, so the offsets stay put and it retries.+ if (error?.isRetriable === true) {+ throw error+ }const errorClass = classifyHogError(error, {bytecodeContract: bytecodeContractOf(error),runtimeContract: currentRuntimeContractHash(),