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(ingestion): sanitize null bytes from group_key before postgres query (#59868)

José Sequeira69e9fce2011a
diff --git a/nodejs/src/ingestion/event-processing/process-groups-step.ts b/nodejs/src/ingestion/event-processing/process-groups-step.ts
index dcdf3e6a8f28..ad807f080cbb 100644
--- a/nodejs/src/ingestion/event-processing/process-groups-step.ts
+++ b/nodejs/src/ingestion/event-processing/process-groups-step.ts
@@ -3,6 +3,7 @@ import { DateTime } from 'luxon'
import { Properties } from '~/plugin-scaffold'
import { PreIngestionEvent, ProjectId, Team, TeamId } from '../../types'
+import { sanitizeString } from '../../utils/db/utils'
import { logger } from '../../utils/logger'
import { captureException } from '../../utils/posthog'
import { TeamManager } from '../../utils/team-manager'
@@ -110,7 +111,7 @@ async function upsertGroup(
teamId,
projectId,
groupTypeIndex,
- groupKey.toString(),
+ sanitizeString(groupKey.toString()),
groupPropertiesToSet || {},
timestamp
)