fix: add DNS propagation delay and frontend error feedback for tunnel recreation

- apps/api/src/services/tunnel.py: add 2-second sleep after discovering the
  tunnel URL to allow Cloudflare DNS edge propagation before returning
- apps/web/src/hooks/use-instance-actions.ts: show alert() with the backend
  error message when recreate tunnel fails, instead of silently swallowing
  errors

Quality gates: ruff clean, tsc clean
This commit is contained in:
2026-05-30 15:33:04 +02:00
parent 351e76c00d
commit b7396d58d2
2 changed files with 13 additions and 3 deletions
+3
View File
@@ -169,6 +169,9 @@ def start_tunnel(
f"Exit code: {exit_code}. Logs:\n{combined_logs[-3000:]}" f"Exit code: {exit_code}. Logs:\n{combined_logs[-3000:]}"
) )
# Wait a moment for Cloudflare DNS edge to propagate the new tunnel subdomain
__import__("time").sleep(2)
logger.info( logger.info(
"Tunnel %s started for %s%s (%s)", "Tunnel %s started for %s%s (%s)",
tunnel_name, tunnel_name,
+10 -3
View File
@@ -127,10 +127,17 @@ export function useInstanceActions(
if (loadingSessionId === session.id) return; if (loadingSessionId === session.id) return;
setLoadingSessionId(session.id); setLoadingSessionId(session.id);
try { try {
await recreateInstanceTunnel(session.project_id, session.repository_id, session.id); await recreateInstanceTunnel(
session.project_id,
session.repository_id,
session.id
);
await onRefresh(); await onRefresh();
} catch { } catch (err) {
// ignore const message =
(err as { response?: { data?: { detail?: string } } })?.response?.data
?.detail || "Failed to recreate tunnel";
alert(message);
} finally { } finally {
setLoadingSessionId(null); setLoadingSessionId(null);
} }