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.

Update import-referrals.ts

Kiran K62f17d83a096
diff --git a/apps/web/lib/tolt/import-referrals.ts b/apps/web/lib/tolt/import-referrals.ts
index 06965df2c1..375b060bad 100644
--- a/apps/web/lib/tolt/import-referrals.ts
+++ b/apps/web/lib/tolt/import-referrals.ts
@@ -179,8 +179,8 @@ async function createReferral({
const customerId = createId({ prefix: "cus_" });
- await Promise.all([
- prisma.customer.create({
+ try {
+ await prisma.customer.create({
data: {
id: customerId,
name:
@@ -198,25 +198,29 @@ async function createReferral({
createdAt: new Date(customer.created_at),
externalId: customer.customer_id,
},
- }),
-
- recordLeadWithTimestamp({
- ...clickEvent,
- event_id: nanoid(16),
- event_name: "Sign up",
- customer_id: customerId,
- timestamp: new Date(customer.created_at).toISOString(),
- }),
+ });
- prisma.link.update({
- where: {
- id: link.id,
- },
- data: {
- leads: {
- increment: 1,
+ await Promise.all([
+ recordLeadWithTimestamp({
+ ...clickEvent,
+ event_id: nanoid(16),
+ event_name: "Sign up",
+ customer_id: customerId,
+ timestamp: new Date(customer.created_at).toISOString(),
+ }),
+
+ prisma.link.update({
+ where: {
+ id: link.id,
},
- },
- }),
- ]);
+ data: {
+ leads: {
+ increment: 1,
+ },
+ },
+ }),
+ ]);
+ } catch (error) {
+ console.error("error creating customer", customer, error);
+ }
}