Skip to content

Commit db63b08

Browse files
committed
fix: propagate FAILED-state errors from inner status-check catch
The inner catch block inside waitForV{1,2}OrganizationReady's status poll only re-threw errors whose message matched 'appears stuck'. The explicit FAILED-fast-fail throw ("Organization creation failed with state FAILED after Xs") and the V2 'creation FAILED' branch were silently swallowed by the same catch, never reaching the outer org- list catch that checks for these phrases. Bug was latent in V1 (creation-status endpoint was already correct) and activated for V2 by this PR's endpoint switch from /status to /creation-status. Extend the inner catch to re-throw any terminal phrase the outer catch would have propagated, so FAILED creation no longer waits the full 15-min maxWaitTime to surface as a generic timeout.
1 parent 8550c8f commit db63b08

1 file changed

Lines changed: 22 additions & 4 deletions

File tree

tests/v2/live-api/helpers/live-api-helpers.js

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1307,8 +1307,17 @@ export const waitForV2OrganizationReady = async (request, orgName = null, maxWai
13071307
}
13081308
}
13091309
} catch (statusError) {
1310-
// Re-throw stuck state errors
1311-
if (statusError.message?.includes('appears stuck')) {
1310+
// Re-throw terminal errors we explicitly threw above (FAILED
1311+
// state, stuck-state) so the outer org-list catch can decide
1312+
// what to do with them. HTTP-level errors from the status
1313+
// endpoint (e.g. 404 on older builds, transient 5xx) fall
1314+
// through and are silently logged so the loop can keep
1315+
// polling the org list.
1316+
if (
1317+
statusError.message?.includes('Organization creation failed') ||
1318+
statusError.message?.includes('appears stuck') ||
1319+
statusError.message?.includes('creation FAILED')
1320+
) {
13121321
throw statusError;
13131322
}
13141323
// Status endpoint might not exist or may fail - that's okay
@@ -1606,8 +1615,17 @@ export const waitForV1OrganizationReady = async (request, orgName = null, maxWai
16061615
}
16071616
}
16081617
} catch (statusError) {
1609-
// Re-throw stuck state errors
1610-
if (statusError.message?.includes('appears stuck')) {
1618+
// Re-throw terminal errors we explicitly threw above (FAILED
1619+
// state, stuck-state) so the outer org-list catch can decide
1620+
// what to do with them. HTTP-level errors from the status
1621+
// endpoint (e.g. 404 on older builds, transient 5xx) fall
1622+
// through and are silently logged so the loop can keep
1623+
// polling the org list.
1624+
if (
1625+
statusError.message?.includes('Organization creation failed') ||
1626+
statusError.message?.includes('appears stuck') ||
1627+
statusError.message?.includes('creation FAILED')
1628+
) {
16111629
throw statusError;
16121630
}
16131631
// Status endpoint might not exist or may fail - that's okay

0 commit comments

Comments
 (0)