From ba9f2677789e9f4f51fb2563b0dcb84c402cbbef Mon Sep 17 00:00:00 2001 From: Khalim Conn-Kowlessar Date: Wed, 16 Apr 2025 13:40:36 +0100 Subject: [PATCH] Adding header logging and error catching on fetch --- src/app/api/plan/trigger/route.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/app/api/plan/trigger/route.ts b/src/app/api/plan/trigger/route.ts index e2adaff..a869085 100644 --- a/src/app/api/plan/trigger/route.ts +++ b/src/app/api/plan/trigger/route.ts @@ -48,12 +48,15 @@ export async function POST(request: NextRequest) { const url = `${process.env.FASTAPI_API_URL}/v1/plan/trigger`; console.log("Triggering plan with url: ", url); + console.log("Triggering plan with headers: ", headers); // For the moment, we don't await any response from the backend, since we haven't split out the trigger - fetch(url, { + void fetch(url, { method: "POST", headers: headers, body: JSON.stringify(validatedBody), + }).catch((err) => { + console.error("Error triggering FastAPI plan:", err); }); console.log("Plan triggered successfully");