Skip to content

Commit 8f69489

Browse files
committed
fix: Add dynamic export to API routes to prevent static rendering errors
1 parent 8e282fc commit 8f69489

13 files changed

Lines changed: 292 additions & 3 deletions

File tree

app/api/api-keys/[id]/route.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@ import { getServerSession } from 'next-auth'
77
import { authOptions } from '@/app/lib/auth'
88
import prisma from '@/app/lib/db'
99

10+
export const dynamic = 'force-dynamic'
11+
export const runtime = 'nodejs'
12+
1013
export async function DELETE(
1114
request: NextRequest,
1215
{ params }: { params: { id: string } }

app/api/api-keys/route.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@ import { authOptions } from '@/app/lib/auth'
88
import prisma from '@/app/lib/db'
99
import { nanoid } from 'nanoid'
1010
import { hash } from 'bcryptjs'
11-
11+
export const dynamic = 'force-dynamic'
12+
export const runtime = 'nodejs'
1213
export async function GET(request: NextRequest) {
1314
try {
1415
const session = await getServerSession(authOptions)

app/api/export/pdf/[scanId]/route.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@ import { getServerSession } from 'next-auth'
77
import { authOptions } from '@/app/lib/auth'
88
import prisma from '@/app/lib/db'
99
import { PDFDocument, rgb, StandardFonts } from 'pdf-lib'
10-
10+
export const dynamic = 'force-dynamic'
11+
export const runtime = 'nodejs'
1112
export async function GET(
1213
request: NextRequest,
1314
{ params }: { params: { scanId: string } }

app/api/history/[id]/route.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@ import { getServerSession } from 'next-auth'
77
import { authOptions } from '@/app/lib/auth'
88
import prisma from '@/app/lib/db'
99

10+
export const dynamic = 'force-dynamic'
11+
export const runtime = 'nodejs'
12+
1013
export async function DELETE(
1114
request: NextRequest,
1215
{ params }: { params: { id: string } }

app/api/history/route.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@ import { getServerSession } from 'next-auth'
77
import { authOptions } from '@/app/lib/auth'
88
import prisma from '@/app/lib/db'
99

10+
export const dynamic = 'force-dynamic'
11+
export const runtime = 'nodejs'
12+
1013
export async function GET(request: NextRequest) {
1114
try {
1215
const session = await getServerSession(authOptions)

app/api/organizations/route.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@ import { getServerSession } from 'next-auth'
77
import { authOptions } from '@/app/lib/auth'
88
import prisma from '@/app/lib/db'
99

10+
export const dynamic = 'force-dynamic'
11+
export const runtime = 'nodejs'
12+
1013
export async function GET(request: NextRequest) {
1114
try {
1215
const session = await getServerSession(authOptions)

app/api/scan-v2/route.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@ import { checkExternalSources } from '@/app/lib/externalSources'
1818
import { checkRateLimit, incrementUsage, checkIPRateLimit as checkAnonLimit } from '@/app/lib/rate-limit'
1919
import { nanoid } from 'nanoid'
2020

21+
export const dynamic = 'force-dynamic'
22+
export const runtime = 'nodejs'
23+
2124
export async function POST(request: NextRequest) {
2225
const headers = getSecurityHeaders()
2326

app/api/stripe/checkout/route.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@ import { authOptions } from '@/app/lib/auth'
99
import { createCheckoutSession } from '@/app/lib/stripe'
1010
import { z } from 'zod'
1111

12+
export const dynamic = 'force-dynamic'
13+
export const runtime = 'nodejs'
14+
1215
const checkoutSchema = z.object({
1316
priceId: z.string(),
1417
tier: z.enum(['PRO', 'BUSINESS']),

app/api/stripe/portal/route.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@ import { authOptions } from '@/app/lib/auth'
99
import { createCustomerPortalSession } from '@/app/lib/stripe'
1010
import prisma from '@/app/lib/db'
1111

12+
export const dynamic = 'force-dynamic'
13+
export const runtime = 'nodejs'
14+
1215
export async function POST(request: NextRequest) {
1316
try {
1417
if (!process.env.STRIPE_SECRET_KEY) {

app/api/watchlist/[id]/route.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@ import { getServerSession } from 'next-auth'
77
import { authOptions } from '@/app/lib/auth'
88
import prisma from '@/app/lib/db'
99

10+
export const dynamic = 'force-dynamic'
11+
export const runtime = 'nodejs'
12+
1013
export async function DELETE(
1114
request: NextRequest,
1215
{ params }: { params: { id: string } }

0 commit comments

Comments
 (0)