Skip to content

armgit / dub

Public Imported from GitHub
0

The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.

Fix nullable link date fields coercing to epoch in webhooks

Kiran Kb5fe97da60e0
diff --git a/apps/web/lib/webhook/sample-events/link-clicked.json b/apps/web/lib/webhook/sample-events/link-clicked.json
index bf82f2ecfa..3cb74a4c12 100644
--- a/apps/web/lib/webhook/sample-events/link-clicked.json
+++ b/apps/web/lib/webhook/sample-events/link-clicked.json
@@ -27,7 +27,7 @@
"partnerId": "pn_cm0lcuvtz000xcutmqw4a7wi3",
"programId": "prog_CYCu7IMAapjkRpTnr8F1azjN",
"archived": false,
- "expiresAt": "1970-01-01T00:00:00.000Z",
+ "expiresAt": null,
"expiredUrl": null,
"disabledAt": null,
"password": null,
diff --git a/apps/web/lib/zod/schemas/links.ts b/apps/web/lib/zod/schemas/links.ts
index 467394de13..ef8fc55747 100644
--- a/apps/web/lib/zod/schemas/links.ts
+++ b/apps/web/lib/zod/schemas/links.ts
@@ -861,11 +861,11 @@ export const linkEventSchema = LinkSchema.extend({
// coerce date fields
createdAt: z.coerce.date(),
updatedAt: z.coerce.date(),
- lastClicked: z.coerce.date(),
- expiresAt: z.coerce.date(),
- disabledAt: z.coerce.date(),
- testCompletedAt: z.coerce.date(),
- testStartedAt: z.coerce.date(),
+ lastClicked: z.coerce.date().nullable(),
+ expiresAt: z.coerce.date().nullable(),
+ disabledAt: z.coerce.date().nullable(),
+ testCompletedAt: z.coerce.date().nullable(),
+ testStartedAt: z.coerce.date().nullable(),
// userId can be null
userId: z.string().nullable(),
});