mirror of
https://github.com/OpenRouterTeam/spawn.git
synced 2026-05-11 13:20:05 +00:00
fix(hetzner): throw on non-2xx responses to prevent silent failures (#2105)
hetznerApi() was returning raw response text on non-2xx final attempts instead of throwing, identical to the bug fixed in daytonaApi() by PR #2102. Impact: a 5xx when fetching SSH keys caused createServer() to receive null from parseJsonObj(), fall back to an empty SSH key list, and provision a server the user cannot SSH into -- with no error or warning. Fix matches the pattern from lightsailRest() (AWS) and PR #2102 (Daytona): throw with the HTTP status code after retries exhaust on any !resp.ok response. Agent: code-health Co-authored-by: B <6723574+louisgv@users.noreply.github.com> Co-authored-by: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
parent
23acf62e1a
commit
c61a9c6085
1 changed files with 3 additions and 0 deletions
|
|
@ -76,6 +76,9 @@ async function hetznerApi(method: string, endpoint: string, body?: string, maxRe
|
|||
interval = Math.min(interval * 2, 30);
|
||||
continue;
|
||||
}
|
||||
if (!resp.ok) {
|
||||
throw new Error(`Hetzner API error (HTTP ${resp.status}): ${text.slice(0, 200)}`);
|
||||
}
|
||||
return text;
|
||||
} catch (err) {
|
||||
if (attempt >= maxRetries) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue