Rallly is an open-source scheduling and collaboration tool designed to make organizing events and meetings easier.
TypeScript i18nextnext-authnextjspostgresqlprismareact-emailt3-stacktailwindcsstrpcturborepotypescriptzod
🐛 Ensure we access latest subscription object
Luke Vellaf10fd919c7c4
diff --git a/apps/web/src/pages/api/stripe/webhook.ts b/apps/web/src/pages/api/stripe/webhook.tsindex d955bc0d3..4f57bde2e 100644--- a/apps/web/src/pages/api/stripe/webhook.ts+++ b/apps/web/src/pages/api/stripe/webhook.ts@@ -68,7 +68,9 @@ export default async function handler(case "customer.subscription.deleted":case "customer.subscription.updated":case "customer.subscription.created":- const subscription = event.data.object as Stripe.Subscription;+ const { id } = event.data.object as Stripe.Subscription;++ const subscription = await stripe.subscriptions.retrieve(id);// check if the subscription is activeconst isActive = subscription.status === "active";@@ -103,7 +105,9 @@ export default async function handler(break;default:// Unexpected event type- console.error(`Unhandled event type ${event.type}.`);+ res.status(400).json({+ error: "Unhandled event type",+ });}res.end();