From 321150261b4be151ad65eaa9239837e368f2ca58 Mon Sep 17 00:00:00 2001 From: Brian Love Date: Mon, 6 Apr 2026 21:31:34 -0700 Subject: [PATCH] fix(angular): normalize relative apiUrl to absolute for LangGraph SDK Client Production environments use relative paths like '/api' that are proxied by Vercel middleware. The LangGraph SDK Client constructor requires an absolute URL. Fix: prepend window.location.origin for relative paths. --- .../src/lib/transport/fetch-stream.transport.ts | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/libs/angular/src/lib/transport/fetch-stream.transport.ts b/libs/angular/src/lib/transport/fetch-stream.transport.ts index 73e6594ae..92c680131 100644 --- a/libs/angular/src/lib/transport/fetch-stream.transport.ts +++ b/libs/angular/src/lib/transport/fetch-stream.transport.ts @@ -25,7 +25,15 @@ export class FetchStreamTransport implements AgentTransport { * @param onThreadId - Optional callback invoked when a new thread is created */ constructor(apiUrl: string, onThreadId?: (id: string) => void) { - this.client = new Client({ apiUrl }); + // Normalize relative paths (e.g. '/api') to absolute URLs. + // The LangGraph SDK Client requires an absolute URL, but production + // environments use relative paths that are proxied by Vercel middleware. + const absoluteUrl = apiUrl.startsWith('http://') || apiUrl.startsWith('https://') + ? apiUrl + : typeof window !== 'undefined' + ? `${window.location.origin}${apiUrl}` + : apiUrl; + this.client = new Client({ apiUrl: absoluteUrl }); this.onThreadId = onThreadId; }