Skip to content

Commit 6498195

Browse files
authored
fix: stop setting platform on Sentry event (#416)
1 parent cbf87d5 commit 6498195

File tree

4 files changed

+19
-8
lines changed

4 files changed

+19
-8
lines changed

posthog-node/CHANGELOG.md

+4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# Next
22

3+
# 4.10.1 – 2025-03-06
4+
5+
1. Fix: only set `platform` on PostHog exception frame properties
6+
37
# 4.10.0 – 2025-03-06
48

59
1. Attach requestId to $feature_flag_called if present in /decide response

posthog-node/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "posthog-node",
3-
"version": "4.10.0",
3+
"version": "4.10.1",
44
"description": "PostHog Node.js integration",
55
"repository": {
66
"type": "git",

posthog-node/src/extensions/sentry-integration.ts

+13-6
Original file line numberDiff line numberDiff line change
@@ -101,11 +101,18 @@ export function createEventProcessor(
101101

102102
const exceptions: _SentryException[] = event.exception?.values || []
103103

104-
exceptions.map((exception) => {
105-
if (exception.stacktrace) {
106-
exception.stacktrace.type = 'raw'
107-
}
108-
})
104+
const exceptionList = exceptions.map((exception) => ({
105+
...exception,
106+
stacktrace: exception.stacktrace
107+
? {
108+
...exception.stacktrace,
109+
type: 'raw',
110+
frames: (exception.stacktrace.frames || []).map((frame: any) => {
111+
return { ...frame, platform: 'node:javascript' }
112+
}),
113+
}
114+
: undefined,
115+
}))
109116

110117
const properties: SentryExceptionProperties & {
111118
// two properties added to match any exception auto-capture
@@ -121,7 +128,7 @@ export function createEventProcessor(
121128
$exception_type: exceptions[0]?.type,
122129
$exception_personURL: personUrl,
123130
$exception_level: event.level,
124-
$exception_list: exceptions,
131+
$exception_list: exceptionList,
125132
// Sentry Exception Properties
126133
$sentry_event_id: event.event_id,
127134
$sentry_exception: event.exception,

posthog-node/test/extensions/sentry-integration.spec.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ describe('PostHogSentryIntegration', () => {
138138
{
139139
type: 'Error',
140140
value: 'example error',
141-
stacktrace: { frames: [], type: 'raw' },
141+
stacktrace: { frames: [] },
142142
mechanism: { type: 'generic', handled: true },
143143
},
144144
],

0 commit comments

Comments
 (0)