From 0203854c2ebe3377437aecf07ea00c795909b9e1 Mon Sep 17 00:00:00 2001 From: Charles Packer Date: Wed, 17 Dec 2025 21:39:48 -0800 Subject: [PATCH] fix: handle browser open errors gracefully in OAuth flow (#285) Co-authored-by: Letta --- src/auth/setup-ui.tsx | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/auth/setup-ui.tsx b/src/auth/setup-ui.tsx index e098be1..15a0722 100644 --- a/src/auth/setup-ui.tsx +++ b/src/auth/setup-ui.tsx @@ -58,10 +58,17 @@ export function SetupUI({ onComplete }: SetupUIProps) { // Auto-open browser try { const { default: open } = await import("open"); - await open(deviceData.verification_uri_complete); + // Use wait: true to properly catch errors when opener command doesn't exist + const subprocess = await open(deviceData.verification_uri_complete, { + wait: false, + }); + // Handle errors from the spawned process (e.g., xdg-open not found in containers) + subprocess.on("error", () => { + // Silently ignore - user can still manually visit the URL shown above + }); } catch (openErr) { // If auto-open fails, user can still manually visit the URL - console.error("Failed to auto-open browser:", openErr); + // This handles cases like missing opener commands in containers } // Get or generate device ID