Rallly is an open-source scheduling and collaboration tool designed to make organizing events and meetings easier.
TypeScript i18nextnext-authnextjspostgresqlprismareact-emailt3-stacktailwindcsstrpcturborepotypescriptzod
🐛 Flush posthog in stripe webhook api route
Luke Vella44f80959bc3a
diff --git a/apps/web/src/app/api/stripe/webhook/route.ts b/apps/web/src/app/api/stripe/webhook/route.tsindex 36722f981..d9b0bf930 100644--- a/apps/web/src/app/api/stripe/webhook/route.ts+++ b/apps/web/src/app/api/stripe/webhook/route.ts@@ -1,6 +1,8 @@import type { Stripe } from "@rallly/billing";import { stripe } from "@rallly/billing";+import { posthog } from "@rallly/posthog/server";import * as Sentry from "@sentry/nextjs";+import { waitUntil } from "@vercel/functions";import type { NextRequest } from "next/server";import { NextResponse } from "next/server";import { isSelfHosted } from "@/utils/constants";@@ -52,6 +54,10 @@ export const POST = withPosthog(async (request: NextRequest) => {await handler(event);+ if (posthog) {+ waitUntil(posthog.flush());+ }+return NextResponse.json({ received: true });} catch (err) {Sentry.captureException(err);