fix: truncate tracking data to prevent Prisma length mismatch errors …#4269
fix: truncate tracking data to prevent Prisma length mismatch errors …#4269KAUSHALCODER123 wants to merge 1 commit into
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. |
Greptile SummaryThis PR adds truncation guards to prevent Prisma P2000 (value-too-long) errors by introducing 12 new length constants in
Confidence Score: 3/5Safe to merge for the fields it fixes, but one field in saveSessionData.ts is still unguarded and will continue to throw the same error the PR aims to eliminate. The src/queries/sql/sessions/saveSessionData.ts — Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[Incoming tracking data] --> B{Query type}
B -->|PRISMA| C[saveEvent - relationalQuery]
B -->|CLICKHOUSE| D[saveEvent - clickhouseQuery]
C --> C1[Truncate: urlPath, urlQuery, UTMs, click IDs, tag, hostname, currency]
C1 --> C2[prisma.websiteEvent.create]
D --> D1[Truncate: same fields]
D1 --> D2[clickhouse.insert / kafka]
E[Session ingestion] --> F[createSession - rawQuery]
F --> F1[Truncate: browser, os, device, screen, language, country, region, city, distinctId]
F1 --> F2[Raw SQL INSERT ON CONFLICT DO NOTHING]
G[Session data] --> H{Query type}
H -->|PRISMA| I[saveSessionData - relationalQuery]
H -->|CLICKHOUSE| J[saveSessionData - clickhouseQuery]
I --> I1[Truncate: dataKey stringValue / distinctId NOT truncated]
I1 --> I2[prisma.sessionData.updateMany / create]
|
| @@ -1,5 +1,5 @@ | |||
| import clickhouse from '@/lib/clickhouse'; | |||
| import { DATA_TYPE } from '@/lib/constants'; | |||
| import { DATA_LENGTH, DATA_TYPE } from '@/lib/constants'; | |||
There was a problem hiding this comment.
…(P2000)