fix(trigger-coolify-deploy): retry PR-preview trigger on 2xx not-found body - #14
Merged
Merged
Conversation
…d body Coolify's deploy-trigger endpoint can return HTTP 200 with the "not found" error embedded in the JSON body (no deployment_uuid) instead of a non-2xx status, while a PR preview resource is still being provisioned. The retry loop only retried on non-2xx responses, so a 2xx/not-found response broke out of the loop and hard-failed immediately on the first attempt instead of retrying for up to PREVIEW_NOT_FOUND_TIMEOUT_SECONDS. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
PR #253 on
the-music-deck-adminhit a new failure after the v4.3.3 exit-22 fix:Deploy API (preview)andDeploy showcase (preview)both failed withERROR: No deployment_uuid in response: {"deployments":[{"message":"Pull request 253 not found for this resource."...}]}on their very first attempt, despite the trigger loop being designed to retry "not found" responses for up toPREVIEW_NOT_FOUND_TIMEOUT_SECONDS(180s) while Coolify provisions the preview resource.Root cause
Coolify's deploy-trigger endpoint returned HTTP 200 with the "not found" error embedded in the JSON body (no
deployment_uuid), not a non-2xx status. The retry loop intrigger_deploy()only checkedhttp_codeto decide whether tobreakout of the retry loop — a 2xx response broke out immediately regardless of body content, then hard-failed a few lines later whendeployment_uuidturned out to be empty.Fix
The loop's
breakcondition now also requires the response body to actually contain adeployment_uuid, so a 2xx response with an embedded "not found" message falls through to the existing "not found" retry branch instead of exiting the loop.Test plan
Deploy API (preview)/Deploy showcase (preview)checks pass once this is merged and the pin is bumped there.