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): store only error message, not stack, in invocation results (#70343)

Meikel Ratza506bf030f31
diff --git a/nodejs/src/cdp/services/monitoring/hog-invocation-results.service.test.ts b/nodejs/src/cdp/services/monitoring/hog-invocation-results.service.test.ts
index 8480a8ae668c..ae8d57a2389e 100644
--- a/nodejs/src/cdp/services/monitoring/hog-invocation-results.service.test.ts
+++ b/nodejs/src/cdp/services/monitoring/hog-invocation-results.service.test.ts
@@ -227,7 +227,8 @@ describe('HogInvocationResultsService', () => {
expect(rows).toHaveLength(1)
expect(rows[0].status).toBe('failed')
expect(rows[0].error_kind).toBe('timeout')
- expect(rows[0].error_message).toContain('timed out')
+ // Exact match: the message only, never the stack trace.
+ expect(rows[0].error_message).toBe('Request timed out after 30s')
})
it('produces no row for an in-flight result that has not finished and has no error', async () => {
diff --git a/nodejs/src/cdp/services/monitoring/hog-invocation-results.service.ts b/nodejs/src/cdp/services/monitoring/hog-invocation-results.service.ts
index 605ee412c41b..3813cd2cd255 100644
--- a/nodejs/src/cdp/services/monitoring/hog-invocation-results.service.ts
+++ b/nodejs/src/cdp/services/monitoring/hog-invocation-results.service.ts
@@ -111,8 +111,9 @@ const truncate = (value: string, max: number): string => {
}
// Best-effort error classification — keeps `error_kind` low-cardinality so the
-// status_idx skipping index stays small. The full message lands in
-// `error_message`, the full stack stays in log_entries.
+// status_idx skipping index stays small. Only the message lands in
+// `error_message`, never the stack trace — app-level executors pass the whole
+// `Error` here, and its stack would otherwise leak into the Invocations tab.
const classifyError = (error: unknown): { kind: string; message: string } => {
if (!error) {
return { kind: '', message: '' }
@@ -121,7 +122,8 @@ const classifyError = (error: unknown): { kind: string; message: string } => {
typeof error === 'string'
? error
: error instanceof Error
- ? error.stack || error.message
+ ? // fall back to the error name so an empty message doesn't blank the row (without the stack)
+ error.message || error.name
: (() => {
try {
return JSON.stringify(error)