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.

guard against undefined/null

Steven Teycd6088eb4b9b
diff --git a/apps/web/app/api/stripe/integration/webhook/utils.ts b/apps/web/app/api/stripe/integration/webhook/utils.ts
index b323a58aa4..5758e4f714 100644
--- a/apps/web/app/api/stripe/integration/webhook/utils.ts
+++ b/apps/web/app/api/stripe/integration/webhook/utils.ts
@@ -130,9 +130,14 @@ export async function getConnectedCustomer({
stripeCustomerId,
stripeAccountId,
}: {
- stripeCustomerId: string;
- stripeAccountId: string;
+ stripeCustomerId?: string | null;
+ stripeAccountId?: string | null;
}) {
+ // if stripeCustomerId or stripeAccountId is not provided, return null
+ if (!stripeCustomerId || !stripeAccountId) {
+ return null;
+ }
+
const connectedCustomer = await stripeAppClient.customers.retrieve(
stripeCustomerId,
{