From d1b8f1626120baae474446e3cbe2451c40d716ed Mon Sep 17 00:00:00 2001 From: Jared Palmer Date: Fri, 16 Jun 2023 16:32:19 -0400 Subject: [PATCH] Really test out the key --- app/api/chat/route.ts | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) 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()