Skip to content

Commit

Permalink
feat: warn when distinct id invalid for replay (#1277)
Browse files Browse the repository at this point in the history
  • Loading branch information
pauldambra authored Jun 28, 2024
1 parent 1087ae8 commit 316bb40
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/posthog-core.ts
Original file line number Diff line number Diff line change
Expand Up @@ -860,6 +860,13 @@ export class PostHog {
if (event_name === '$snapshot') {
const persistenceProps = { ...this.persistence.properties(), ...this.sessionPersistence.properties() }
properties['distinct_id'] = persistenceProps.distinct_id
if (
// we spotted one customer that was managing to send `false` for ~9k events a day
!(isString(properties['distinct_id']) || isNumber(properties['distinct_id'])) ||
isEmptyString(properties['distinct_id'])
) {
logger.error('Invalid distinct_id for replay event. This indicates a bug in your implementation')
}
return properties
}

Expand Down

0 comments on commit 316bb40

Please sign in to comment.