This commit is contained in:
Marc Seitz
2025-11-23 22:20:10 +01:00
parent 058ed871f9
commit f27a3a83f0
2 changed files with 15 additions and 2 deletions

View File

@@ -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.");
}
}

View File

@@ -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) {