Fix unclear error when deploying to improperly-tagged container app in non-revision mode#6353
Conversation
…ing `SupportsDelayedProvisioning()`
Azure Dev CLI Install InstructionsInstall scriptsMacOS/Linux
bash: pwsh: WindowsPowerShell install MSI install Standalone Binary
MSI
Documentationlearn.microsoft.com documentationtitle: Azure Developer CLI reference
|
weikanglim
left a comment
There was a problem hiding this comment.
@JeffreyCA Thanks for fixing this!
Fixes #6342
Problem
When deploying to a Container App that is missing or improperly tagged, users were getting an unhelpful error:
Instead of the previous clear, actionable message:
Root Cause
When we added Container Apps to
SupportsDelayedProvisioning()in #5694 (v1.20.0), it maderesolveServiceResourceswallowResourceNotFoundErrorerrors and return an empty resource instead of propagating the error.When
Deploy()later tried to use the resolved resource in non-revision mode, it would callGetTargetResourceagain to fetch the resource. However, this call goes throughresolveServiceResourcewhich was still swallowing the error, returning an empty resource.Solution
This PR implements @weikanglim's suggestion in #6342 (comment) to implement a custom
ResolveTargetResourceinstead of usingSupportsDelayedProvisioning:Remove Container Apps from
SupportsDelayedProvisioning()- Only AKS remains for backward compatibility. The method is now marked as deprecated.Implement
TargetResourceResolverforcontainerAppTarget- This localizes the delayed provisioning logic within the Container App target itself:ResourceNotFoundError): return partial target resource (with resource group but no resource name) to support bicep-based deploymentsNon-revision mode now gets proper errors - When
Deploy()callsGetTargetResourcein non-revision mode, errors are no longer swallowed, so users see the helpful error message about missing tags.Validation
Tested revision-based todo-nodejs-mongo-aca sample app deploys successfully: https://github.com/Azure-Samples/todo-nodejs-mongo-aca/pull/8/files#diff-834bc11e3cb55730076a7d70767b75f794dc9a37305f27d99926e0fd24363c13
Tested deploying improperly-tagged ACA in non-revision mode fails with previous error:
