Skip to content

fix(cloudfront): log errors in waitUntilDeployed instead of silently retrying [PE1-6037] - #131

Closed
LCaparelli wants to merge 1 commit into
developfrom
fix/PE1-6037-getdistribution-iam
Closed

LCaparelli wants to merge 1 commit into
developfrom
fix/PE1-6037-getdistribution-iam

Conversation

@LCaparelli

Copy link
Copy Markdown
Member

Description

Adds a log line in waitUntilDeployed for non-NoSuchDistribution errors from GetDistribution, so they are visible in controller logs instead of being silently swallowed.

Motivation and Context

The waitUntilDeployed condition function was silently returning (false, nil) for all errors except NoSuchDistribution, causing the poll loop to retry until timeout without any log output. This made it impossible to diagnose issues like missing IAM permissions (cloudfront:GetDistribution) from controller logs alone — the only symptom was a generic context deadline exceeded.

Jira: https://gympass.atlassian.net/browse/PE1-6037

How has this been tested?

  • All 11 existing Delete suite tests pass
  • The log line is exercised by existing mock-error tests

Checklist

  • I have implemented automated tests for the changes.
  • I have updated the documentation accordingly.

@LCaparelli
LCaparelli requested a review from Copilot July 2, 2026 21:27
…retrying

Non-NoSuchDistribution errors from GetDistribution were silently
swallowed, making IAM permission issues invisible during deletion.
@LCaparelli
LCaparelli force-pushed the fix/PE1-6037-getdistribution-iam branch from 72c245b to 9fedbcb Compare July 2, 2026 21:29

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Note

Copilot couldn't run its full agentic review because no GitHub Actions runner was available. Make sure your repository has a runner available to run Copilot's review, or add a copilot-setup-steps.yml file specifying one with the runs-on attribute. See the docs for more details.

This PR makes CloudFront waitUntilDeployed retries observable by logging non-NoSuchDistribution errors returned by GetDistribution, avoiding silent retry loops that only end in a timeout.

Changes:

  • Add log.Printf for unexpected GetDistribution errors before returning (false, nil) (retry).
  • Import Go’s standard log package to emit the message.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines 294 to 295
var eTag *string
condition := func(context.Context) (done bool, err error) {
"context"
"errors"
"fmt"
"log"
@LCaparelli LCaparelli closed this Jul 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants