fix(webapp): null-safe getTime() calls in replication service for createdAt/updatedAt
DE
4mo ago+100572+100572+012345678901234567890123456789012345678901234567890123456789-56886-56886-01234567890123456789012345678901234567890123456789
Fixes #3519
Changes
- Added null-safe optional chaining (?.getTime() ?? Date.now()) to \createdAt\ and \updatedAt\ in \ oTaskRunInsertArray\ and \ oSessionInsertArray\
- Prevents \TypeError: Cannot read properties of undefined (reading 'getTime')\ in ClickHouse replication service
Root cause
When task runs or sessions are synced before their timestamps are fully populated in the CDC message, .getTime()\ was called on \undefined, crashing the replication stream.
Summary by cubic
Make timestamp handling null-safe in the ClickHouse replication services to stop crashes when CDC messages lack createdAt/updatedAt. Stabilizes the replication stream and addresses #3519.
- Bug Fixes
- Use
updatedAt?.getTime() ?? Date.now()andcreatedAt?.getTime() ?? Date.now()inapps/webapp/app/services/runsReplicationService.server.ts. - Apply the same null-safe logic in
apps/webapp/app/services/sessionsReplicationService.server.ts. - Prevents
TypeError: Cannot read properties of undefined (reading 'getTime')during replication.
- Use