diff --git a/app/api/chat/route.ts b/app/api/chat/route.ts index 0024ea4..ec1ce73 100644 --- a/app/api/chat/route.ts +++ b/app/api/chat/route.ts @@ -8,9 +8,11 @@ import { nanoid } from '@/lib/utils' export const runtime = 'edge' export async function POST(req: Request) { - const session = await auth() - if (session == null) { - return new Response('Unauthorized', { status: 401 }) + if (process.env.VERCEL_ENV !== 'preview') { + const session = await auth() + if (session == null) { + return new Response('Unauthorized', { status: 401 }) + } } const json = await req.json()