Fix/prisma length mismatch#4268
Conversation
|
@KAUSHALCODER123 is attempting to deploy a commit to the Umami Software Team on Vercel. A member of the Team first needs to authorize it. |
|
please accept my pull request |
Greptile SummaryThis PR adds length-capped
Confidence Score: 3/5The truncation fix is correct where applied but has a gap in the ClickHouse event-data path; the rrweb library jump across 16 alpha releases is a substantial unreviewed change bundled into this PR. The Prisma truncation logic is solid — all constants match the schema and the affected files are consistently updated — except saveEventData.ts whose ClickHouse path was overlooked, leaving it without truncation while the parallel saveSessionData.ts ClickHouse path was fixed. The bigger concern is the unrelated rrweb upgrade from alpha.4 to alpha.20 plus two new packages: this is a large cross-cutting change with no test coverage visible in the diff, and any regression in the replay recorder or player would be hard to attribute without a separate PR. src/queries/sql/events/saveEventData.ts (ClickHouse path gap) and package.json / pnpm-lock.yaml (unreviewed rrweb major bump) Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[Incoming Tracking Request] --> B{Route}
B --> C[saveEvent]
B --> D[saveEventData]
B --> E[createSession]
B --> F[saveSessionData]
C --> C1[Relational: truncate UTM, clickIDs, tag, hostname, currency ✅]
C --> C2[ClickHouse: truncate UTM, clickIDs, tag, hostname ✅]
D --> D1[Relational: truncate dataKey, stringValue ✅]
D --> D2[ClickHouse: NO truncation ❌]
E --> E1[Relational: truncate browser, os, device, screen, language, country, region, city, distinctId ✅]
F --> F1[Relational: truncate dataKey, stringValue ✅]
F --> F2[ClickHouse: truncate dataKey, stringValue ✅]
style D2 fill:#ff6666,color:#fff
|
| "react-window": "^1.8.6", | ||
| "redis": "^4.5.1", | ||
| "request-ip": "^3.3.0", | ||
| "rrweb": "2.0.0-alpha.4", | ||
| "rrweb-player": "1.0.0-alpha.4", | ||
| "rrweb": "2.0.0-alpha.20", |
There was a problem hiding this comment.
Unrelated major rrweb version bump bundled with truncation fix
This PR upgrades rrweb from 2.0.0-alpha.4 to 2.0.0-alpha.20 and adds two new packages (@rrweb/rrweb-plugin-console-record, @rrweb/rrweb-plugin-console-replay), which is a substantial jump across 16 alpha releases. Because these changes are bundled with the unrelated Prisma truncation fix, a regression in the replay player or the recorder would be hard to bisect. The console recording feature also alters what data is captured and stored per session. This should be split into a separate PR so the rrweb upgrade can be reviewed and tested independently.
|
did again |
|
I think you need to remove the unrelated recording changes from this PR before it can be accepted |
Changes Made
Branch: fix/prisma-length-mismatch
Commit: fix: truncate tracking data to prevent Prisma length mismatch errors (P2000)
Summary:
Added length constants to src/lib/constants.ts based on the PostgreSQL schema (UTM params, click IDs, tags, hostnames, etc.).
Applied .substring() truncation to all relevant fields in saveEvent.ts, saveEventData.ts, saveSessionData.ts, and createSession.ts.
This ensures that any excessively long strings sent to the tracking API (e.g., from long UTM parameters) are safely truncated before reaching the database, preventing the P2000 error.