Fix misleading error message in cert generation and add deployment status feedback#1494
Draft
Fix misleading error message in cert generation and add deployment status feedback#1494
Conversation
Co-authored-by: lionello <591860+lionello@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Bad error message for
Fix misleading error message in cert generation when domains exist but cert generation fails
Oct 3, 2025
defang cert gen
lionello
requested changes
Oct 6, 2025
src/pkg/cli/cert.go
Outdated
| } | ||
| if cnt == 0 { | ||
| // Only show the "no domainname found" message if there truly are no domains in the compose file | ||
| if cnt == 0 && !hasDomains { |
Member
There was a problem hiding this comment.
Need to handle both cases: if cnt == 0 && hasDomains then the deployment is probably not finished.
Contributor
Author
There was a problem hiding this comment.
Addressed in commit d7405be. The code now handles both cases when cnt == 0:
- No domains: Shows "No domainname found" message
- Domains exist: Shows "Deployment may not be finished yet; please wait and try again"
Contributor
Author
There was a problem hiding this comment.
Done. Added handling for the case when cnt == 0 && hasDomains to inform the user that the deployment may not be finished yet. Changes in commit d7405be.
raphaeltm
requested changes
Nov 26, 2025
src/pkg/cli/cert.go
Outdated
| } | ||
| if cnt == 0 { | ||
| // Only show the "no domainname found" message if there truly are no domains in the compose file | ||
| if cnt == 0 && !hasDomains { |
When domains exist but no cert generation was processed (cnt == 0 && hasDomains), inform the user that the deployment may not be finished yet instead of staying silent. Co-authored-by: raphaeltm <910895+raphaeltm@users.noreply.github.com>
Copilot
AI
changed the title
Fix misleading error message in cert generation when domains exist but cert generation fails
Fix misleading error message in cert generation and add deployment status feedback
Nov 26, 2025
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.
Description
Fixes the misleading error message in
defang cert genthat would display "Nodomainnamefound in compose file; no HTTPS cert generation needed" even when domain names were present in the compose file but certificate generation failed for other reasons. Additionally, provides informative feedback when the deployment is not yet complete.Problem
The original logic only checked if any certificates were processed (
cnt == 0) to determine whether to show the "no domainname found" message. However, the countercntis only incremented for services that require ACME certificate generation (whereserviceInfo.ZoneId == ""). This caused the misleading message to appear in scenarios where:Solution
Added a
hasDomainscheck that scans the compose project to determine if any domain names actually exist. The function now handles two distinct scenarios whencnt == 0:!hasDomains): Shows "Nodomainnamefound in compose file; no HTTPS cert generation needed"hasDomains): Shows "Deployment may not be finished yet; please wait and try again"This ensures users receive accurate feedback about why certificate generation isn't proceeding, whether it's due to truly missing domain names or an incomplete deployment.
Changes
GenerateLetsEncryptCert()insrc/pkg/cli/cert.goto add domain detection logic and differentiate between missing domains vs incomplete deploymentsTestHasDomains()test to validate the domain detection functionalityLinked Issues
Fixes #1476
Checklist
Original prompt
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.