Skip to content

Commit 66c58c2

Browse files
Fix: Add dynamic rendering and runtime configuration for Stripe webhook endpoint
1 parent d6871c8 commit 66c58c2

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

app/api/stripe/webhook/route.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@ import { NextRequest, NextResponse } from "next/server";
22
import Stripe from "stripe";
33
import { Client, Databases } from "node-appwrite";
44

5+
// Force dynamic rendering for webhook endpoint
6+
export const dynamic = "force-dynamic";
7+
export const runtime = "nodejs";
8+
59
// Map Stripe price IDs to subscription types
610
const PRICE_ID_TO_SUBSCRIPTION: Record<string, string> = {
711
[process.env.NEXT_PUBLIC_STRIPE_PRICE_ADS_FREE || ""]: "ads-free",
@@ -20,6 +24,14 @@ function getAppwriteClient() {
2024
return new Databases(client);
2125
}
2226

27+
// GET handler for testing/health check
28+
export async function GET() {
29+
return NextResponse.json({
30+
message: "Stripe webhook endpoint is active",
31+
timestamp: new Date().toISOString(),
32+
});
33+
}
34+
2335
export async function POST(request: NextRequest) {
2436
const body = await request.text();
2537
const signature = request.headers.get("stripe-signature");

0 commit comments

Comments
 (0)