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(cdp): populate fetch response body with client-side error info (#70981)

Meikel Ratz70f534f10e3a
diff --git a/nodejs/src/cdp/services/hog-executor.service.ts b/nodejs/src/cdp/services/hog-executor.service.ts
index a5ff1ab8b632..b158d7ab5c2f 100644
--- a/nodejs/src/cdp/services/hog-executor.service.ts
+++ b/nodejs/src/cdp/services/hog-executor.service.ts
@@ -972,12 +972,19 @@ export class HogExecutorService {
body = undefined
}
+ // Keep the status 500 fallback so template guards like `if (res.status
+ // >= 400) throw` still fire on a client-side abort and prevent
+ // subsequent fetches in multi-step templates from running against
+ // broken assumptions. Populate body with the real client-side error
+ // name and message so the terminal log stops reading as "status 500"
+ // with an empty body and instead tells the customer what actually
+ // happened (connect timeout, socket abort, DNS failure, etc.).
const hogVmResponse: {
status: number
body: unknown
} = {
status: fetchResponse?.status ?? 500,
- body,
+ body: body ?? (fetchError ? `${fetchError.name}: ${fetchError.message}` : undefined),
}
// Finally we create the response object as the VM expects