: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(error-tracking): limit the missing release banner to JS exceptions (#98349)
Aleksander Błaszkiewicz02448789fcf3
diff --git a/frontend/src/lib/components/Errors/utils.test.ts b/frontend/src/lib/components/Errors/utils.test.tsindex acabac7459c5..994fe0c53d72 100644--- a/frontend/src/lib/components/Errors/utils.test.ts+++ b/frontend/src/lib/components/Errors/utils.test.ts@@ -342,6 +342,11 @@ describe('Error Display', () => {['one of two symbol sets with a release', {}, [UPLOADED_SET, UPLOADED_SET_WITH_RELEASE], false],['two symbol sets uploaded without a release', {}, [UPLOADED_SET, UPLOADED_SET], true],['a frame whose record did not load', {}, [UPLOADED_SET, undefined], false],+ ['a Node.js exception', { $lib: 'posthog-node' }, [UPLOADED_SET, UPLOADED_SET], true],+ ['an edge runtime exception', { $lib: 'posthog-edge' }, [UPLOADED_SET, UPLOADED_SET], true],+ ['a Segment Node.js exception', { $lib: 'analytics-node' }, [UPLOADED_SET, UPLOADED_SET], false],+ ['a Rust exception', { $lib: 'posthog-rs' }, [UPLOADED_SET, UPLOADED_SET], false],+ ['an exception from an unknown SDK', { $lib: undefined }, [UPLOADED_SET, UPLOADED_SET], false],])('reports a release the SDK never sent for %s', (_name, properties, records, expected) => {const frames = records.map((_, index) => ({ raw_id: `frame-${index}` }) as ErrorTrackingStackFrame)const keyedRecords = Object.fromEntries(@@ -349,6 +354,7 @@ describe('Error Display', () => {record ? [[`frame-${index}`, record as ErrorTrackingStackFrameRecord]] : []))- expect(isReleaseIdMissingFromSDK(properties as ErrorEventProperties, frames, keyedRecords)).toBe(expected)+ const eventProperties = { $lib: 'web', ...properties } as ErrorEventProperties+ expect(isReleaseIdMissingFromSDK(eventProperties, frames, keyedRecords)).toBe(expected)})})diff --git a/frontend/src/lib/components/Errors/utils.ts b/frontend/src/lib/components/Errors/utils.tsindex 360561c6a8cb..7e58c968cf07 100644--- a/frontend/src/lib/components/Errors/utils.ts+++ b/frontend/src/lib/components/Errors/utils.ts@@ -264,6 +264,10 @@ export function getExceptionRelease(properties: ErrorEventProperties): ErrorTrac}}+// Only posthog-js (`web`) and posthog-node (`posthog-node`, `posthog-edge`) report `$release_id`.+// Other libraries that share their runtime, such as analytics-node, never send it.+const LIBS_REPORTING_RELEASE_ID: ReadonlySet<string> = new Set(['web', 'posthog-node', 'posthog-edge'])+// Uploaded symbol sets without a release leave the SDK's `$release_id` as the only source of a release.// A symbol set fetched by URL never carries one, so it cannot signal a missing `$release_id`.// A frame with no loaded record still could, so the answer stays unknown until every frame has one.@@ -275,6 +279,9 @@ export function isReleaseIdMissingFromSDK(if (!properties || properties['$release_id'] || getExceptionRelease(properties)) {return false}+ if (!LIBS_REPORTING_RELEASE_ID.has(String(properties['$lib'] ?? '').toLowerCase())) {+ return false+ }const records = frames.map((frame) => stackFrameRecords[frame.raw_id])if (records.some((record) => !record)) {