fix: handle browser open errors gracefully in OAuth flow (#285)

Co-authored-by: Letta <noreply@letta.com>
This commit is contained in:
Charles Packer
2025-12-17 21:39:48 -08:00
committed by GitHub
parent b9e52d20e8
commit 0203854c2e

View File

@@ -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