From 338af1cf1916c496f9a4f141819461bb93a41a67 Mon Sep 17 00:00:00 2001 From: xenseing Date: Wed, 15 Jul 2026 02:42:43 +0530 Subject: [PATCH 1/2] fix: return clear error when Humanloop API key is missing --- app/api/chat/route.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/app/api/chat/route.ts b/app/api/chat/route.ts index a3c697e..3f8d1ee 100644 --- a/app/api/chat/route.ts +++ b/app/api/chat/route.ts @@ -12,9 +12,13 @@ const client = new HumanloopClient({ export async function POST(req: Request) { if (!HUMANLOOP_API_KEY) { - throw new Error('HUMANLOOP_API_KEY is not set') + return new Response('Missing HUMANLOOP_API_KEY environment variable', { + status: 500, + statusText: 'Missing Humanloop API key' + }) } + const { messages } = await req.json() const chatResponse = await client.prompts.callStream({ From cc5bffaf4c58bf4874b09e4349a5ab08102a5def Mon Sep 17 00:00:00 2001 From: xenseing Date: Wed, 15 Jul 2026 02:48:55 +0530 Subject: [PATCH 2/2] fix: return clear error when Humanloop API key is missing --- app/api/chat/route.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/api/chat/route.ts b/app/api/chat/route.ts index 3f8d1ee..0b8294d 100644 --- a/app/api/chat/route.ts +++ b/app/api/chat/route.ts @@ -18,9 +18,9 @@ export async function POST(req: Request) { }) } - const { messages } = await req.json() + const chatResponse = await client.prompts.callStream({ path: 'sdk-example', messages