fix: handle Cloud Run 409 by linking to existing service; show provisioning spinner not failure

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-02-19 17:31:01 -08:00
parent f4ab70822c
commit b42edbe681
2 changed files with 14 additions and 2 deletions

View File

@@ -112,6 +112,16 @@ export async function provisionTheiaWorkspace(
if (!createRes.ok) {
const body = await createRes.text();
// 409 = service already exists — fetch its URL instead of failing
if (createRes.status === 409) {
console.log(`[workspace] Cloud Run service already exists: ${serviceName} — fetching existing URL`);
const serviceUrl = await waitForServiceUrl(serviceName, token);
await allowUnauthenticated(serviceName, token);
console.log(`[workspace] Linked to existing service: ${serviceName}${serviceUrl}`);
return { serviceUrl, serviceName };
}
throw new Error(`Cloud Run create service failed (${createRes.status}): ${body}`);
}