radius-project / radius

Radius is a cloud-native, portable application platform that makes app development easier for teams building cloud-native apps.
https://radapp.io
Apache License 2.0
1.49k stars 96 forks source link

Error message is WILD when deploying Azure resources in a recipe without credentials #6305

Open rynowak opened 1 year ago

rynowak commented 1 year ago

Bug information

Steps to reproduce (required)

Observed behavior (required)

This is the error message. Like I said, it's WILD.

This is very unreadable, and it's an easy mistake to make.

❯ rad deploy app.bicep -w prod-azure
Building app.bicep...
Deploying template 'app.bicep' for application 'demo' and environment 'prod-azure' from workspace 'prod-azure'...

Deployment In Progress...

.                    db              Applications.Link/redisCaches
Error: {
  "code": "DeploymentFailed",
  "message": "At least one resource deployment operation failed. Please see the details for the specific operation that failed.",
  "details": [
    {
      "code": "ResourceDeploymentFailure",
      "message": "Failed",
      "details": [
        {
          "code": "Internal",
          "message": "GET https://10.0.0.1:443/apis/api.ucp.dev/v1alpha3/planes/radius/local/resourcegroups/default/providers/Microsoft.Resources/deployments/recipe1692924814787584797/operationStatuses/08585086820706358834\n--------------------------------------------------------------------------------\nRESPONSE 200: 200 OK\nERROR CODE: DeploymentFailed\n--------------------------------------------------------------------------------\n{\n  \"id\": null,\n  \"resourceId\": null,\n  \"name\": null,\n  \"status\": \"Failed\",\n  \"startTime\": null,\n  \"endTime\": null,\n  \"percentComplete\": null,\n  \"error\": {\n    \"code\": \"DeploymentFailed\",\n    \"target\": null,\n    \"message\": \"At least one resource deployment operation failed. Please see the details for the specific operation that failed.\",\n    \"details\": [\n      {\n        \"code\": \"ResourceDeploymentFailure\",\n        \"target\": null,\n        \"message\": \"An exception was encountered. Current deployment operation has failed. Error message: 'Authentication failed. Please ensure you have registered an Azure credential via 'rad credential register azure', and that it has the proper RBAC permissions on your target scope. For more information visit https://docs.radapp.dev/reference/cli/rad_credential/'. Exception: 'k8s.Autorest.HttpOperationException: Operation returned an invalid status code 'NotFound'\\n   at k8s.Kubernetes.SendRequestRaw(String requestContent, HttpRequestMessage httpRequest, CancellationToken cancellationToken)\\n   at k8s.AbstractKubernetes.k8s.ICoreV1Operations.ReadNamespacedSecretWithHttpMessagesAsync(String name, String namespaceParameter, Nullable`1 pretty, IReadOnlyDictionary`2 customHeaders, CancellationToken cancellationToken)\\n   at k8s.CoreV1OperationsExtensions.ReadNamespacedSecretAsync(ICoreV1Operations operations, String name, String namespaceParameter, Nullable`1 pretty, CancellationToken cancellationToken)\\n   at DeploymentEngine.KubeCredentials.FetchCredentialAsync(CancellationToken cancellationToken) in /src/src/DeploymentEngine/Credentials/KubeCredentials.cs:line 62\\n   at DeploymentEngine.KubeCredentials.GetClientAsync(CancellationToken cancellationToken) in /src/src/DeploymentEngine/Credentials/KubeCredentials.cs:line 87'\",\n        \"details\": null,\n        \"additionalInfo\": null\n      },\n      {\n        \"code\": \"ResourceDeploymentFailure\",\n        \"target\": null,\n        \"message\": \"An exception was encountered. Current deployment operation has failed. Error message: 'Authentication failed. Please ensure you have registered an Azure credential via 'rad credential register azure', and that it has the proper RBAC permissions on your target scope. For more information visit https://docs.radapp.dev/reference/cli/rad_credential/'. Exception: 'k8s.Autorest.HttpOperationException: Operation returned an invalid status code 'NotFound'\\n   at k8s.Kubernetes.SendRequestRaw(String requestContent, HttpRequestMessage httpRequest, CancellationToken cancellationToken)\\n   at k8s.AbstractKubernetes.k8s.ICoreV1Operations.ReadNamespacedSecretWithHttpMessagesAsync(String name, String namespaceParameter, Nullable`1 pretty, IReadOnlyDictionary`2 customHeaders, CancellationToken cancellationToken)\\n   at k8s.CoreV1OperationsExtensions.ReadNamespacedSecretAsync(ICoreV1Operations operations, String name, String namespaceParameter, Nullable`1 pretty, CancellationToken cancellationToken)\\n   at DeploymentEngine.KubeCredentials.FetchCredentialAsync(CancellationToken cancellationToken) in /src/src/DeploymentEngine/Credentials/KubeCredentials.cs:line 62\\n   at DeploymentEngine.KubeCredentials.GetClientAsync(CancellationToken cancellationToken) in /src/src/DeploymentEngine/Credentials/KubeCredentials.cs:line 87'\",\n        \"details\": null,\n        \"additionalInfo\": null\n      }\n    ],\n    \"additionalInfo\": null\n  },\n  \"properties\": null,\n  \"operations\": null\n}\n--------------------------------------------------------------------------------\n"
        }
      ]
    }
  ]
}

TraceId:  c846957fed8788414b1c66d20b15d4ef

Desired behavior (required)

Error message is comprehensible.

AB#9092

AB#9510

rynowak commented 1 year ago

This is what it looks like at the console

image