fix docker build error
This commit is contained in:
@@ -2,12 +2,7 @@ import { headers } from "next/headers";
|
||||
import { NextResponse } from "next/server";
|
||||
import Stripe from "stripe";
|
||||
import { env } from "~/env";
|
||||
import { syncStripeData } from "~/server/billing/payments";
|
||||
import { db } from "~/server/db";
|
||||
|
||||
const stripe = new Stripe(env.STRIPE_SECRET_KEY!, {
|
||||
apiVersion: "2025-01-27.acacia",
|
||||
});
|
||||
import { getStripe, syncStripeData } from "~/server/billing/payments";
|
||||
|
||||
const allowedEvents: Stripe.Event.Type[] = [
|
||||
"checkout.session.completed",
|
||||
@@ -44,6 +39,8 @@ export async function POST(req: Request) {
|
||||
return new NextResponse("No webhook secret", { status: 400 });
|
||||
}
|
||||
|
||||
const stripe = getStripe();
|
||||
|
||||
try {
|
||||
const event = stripe.webhooks.constructEvent(
|
||||
body,
|
||||
|
@@ -2,7 +2,7 @@ import Stripe from "stripe";
|
||||
import { env } from "~/env";
|
||||
import { db } from "../db";
|
||||
|
||||
function getStripe() {
|
||||
export function getStripe() {
|
||||
if (!env.STRIPE_SECRET_KEY) {
|
||||
throw new Error("STRIPE_SECRET_KEY is not set");
|
||||
}
|
||||
|
Reference in New Issue
Block a user