Skip to content

Papermark is the open-source DocSend alternative and secure data rooms with built-in analytics and custom domains.

fix

Marc Seitzf27a3a83f06f
diff --git a/ee/stripe/webhooks/customer-subscription-deleted.ts b/ee/stripe/webhooks/customer-subscription-deleted.ts
index e3ddbc83..cdb309bf 100644
--- a/ee/stripe/webhooks/customer-subscription-deleted.ts
+++ b/ee/stripe/webhooks/customer-subscription-deleted.ts
@@ -1,6 +1,7 @@
import { NextApiResponse } from "next";
import { FREE_PLAN_LIMITS } from "@/ee/limits/constants";
+import { Prisma } from "@prisma/client";
import Stripe from "stripe";
import prisma from "@/lib/prisma";
@@ -40,12 +41,24 @@ export async function customerSubscriptionDeleted(
type: "info",
});
} catch (error) {
+ if (
+ error instanceof Prisma.PrismaClientKnownRequestError &&
+ error.code === "P2025"
+ ) {
+ await log({
+ message: `Team with Stripe ID ${stripeId} and Subscription ID ${subscriptionId} not found`,
+ type: "error",
+ });
+ return res
+ .status(200)
+ .send("Team not found in database. Customer deleted their account.");
+ }
await log({
message: `Error updating team ${stripeId} subscription ${subscriptionId}: ${error}`,
type: "error",
});
return res
.status(200)
- .send("Team not found in database. Customer deleted their account.");
+ .send("Error processing subscription deletion webhook.");
}
}
diff --git a/ee/stripe/webhooks/invoice-upcoming.ts b/ee/stripe/webhooks/invoice-upcoming.ts
index afeb3fa8..d43087aa 100644
--- a/ee/stripe/webhooks/invoice-upcoming.ts
+++ b/ee/stripe/webhooks/invoice-upcoming.ts
@@ -31,7 +31,7 @@ export async function invoiceUpcoming(
item.price.recurring.interval_count === 12)
);
}
- return res.status(200).json({ received: true });
+ return false;
});
if (!hasYearlyPlan) {