ReviewOS

stacks/ts-analytics

CRITICAL: lost session updates on concurrent pageviews (blind putItem)

#161
Closed glennmichael123 opened this 9 days ago ·
9 days ago

Severity: CRITICAL (data accuracy) · Where: src/models/orm/index.ts:392; callers collect.ts:228,275,312,347 Session.upsert() does a blind putItem with no ConditionExpression/version check. Trigger: two near-simultaneous pageviews (multi-tab, fast nav, separate Lambda instances) — the second write overwrites the first's pageViewCount increment. Impact: undercounted pageviews, wrong bounce rate and duration; also drives the bounce/entry race (#…). Fix: route callers to the existing atomic updateMetrics() UpdateExpression path (orm/index.ts:403), or add a conditional/version write.

Sign in to comment on this issue.