Azure / azure-functions-on-container-apps

Docs , samples and issues for Azure Functions on Azure Container Apps
MIT License
74 stars 18 forks source link

Call to containerApps RP failed #18

Closed mcollier closed 8 months ago

mcollier commented 1 year ago

Using the Azure CLI (v2.48.1) to attempt to create a new Function App on an existing Azure Container App environment results in a "Call to containerApps RP failed!" error message.

No additional details are provided in the terminal, or in the Azure portal. The error message does not provide enough information for a user to debug and resolve the error.

Error message

_Call to containerApps RP failed!, HttpStatusCode=BadRequest, RequestId='bea57246-14cc-436c-b40c-39b96fbb23ee', Uri=https://management.azure.com/subscriptions/xxxxxx/resourceGroups/mcfuncaca-env_FunctionApps_58b650ec-0e67-47c9-a962-374b8f2e991a/providers/Microsoft.App/containerApps/mcfuncaca-ratings-api?api-version=2022-11-01-preview, CorrelationId=00000000-0000-0000-0000-000000000000_

mcollier commented 1 year ago

@stuartleeks FYI

chandrod commented 1 year ago

@mcollier this looks like an image/registry issue (probably some settings changed on ACR). There are 2 failed requests at around 2023-05-18 02:25:17.2536840 and then successful request at 2023-05-18 14:22:28.2466150. Other than image we only see some appSettings differences (between success and failure cases) like AppInsights which shouldn't matter. If the acr/registry and image are healthy then the request will be successful.

mcollier commented 1 year ago

@chandrod How would a user know that information? I would like to encourage a more detailed error message that provides enough detail for a user to troubleshoot & ideally resolve the error.

chandrod commented 1 year ago

Yes @mcollier, that makes sense. We will collaborate with Azure ContainerApps to get authentic error wrt bad image/registry to customers.

mcollier commented 1 year ago

@chandrod, thank you. In my opinion, any ""Call to containerApps RP failed!" error should include details of what exactly failed so that the user can attempt to resolve. If it is a user error, tell the user enough to fix the issue. If it is a platform error, give the user the necessary data to potentially open a detailed support ticket with Azure support.

embonshai commented 1 year ago

hi I am getting the same error when trying to create containatarized function app. Is there a way to overcome it? Do I need to change something in my acr?

chandrod commented 1 year ago

hi I am getting the same error when trying to create containatarized function app. Is there a way to overcome it? Do I need to change something in my acr? We are working to give better error messages for any failures. 1) Could you please mention the functionapp name, region you are trying in and resource group. 2) Are you doing a create for the first time with a custom image or you are using the default image, or are you trying to update an image in a pre-existing app. 3) What client are you using (for eg. portal/cli/bicep etc) One of the main reasons is that system is unable to access your image in acr for eg. Image with incorrect username and password for a private registry can result in an error.

chandrod commented 1 year ago

We have made a fix to let customer know in error message if there was an issue with acr or image and not show this unhelpful message "Call to ContainerApps failed". Will update this thread when it's deployed.

tang2087 commented 1 year ago

Hi, I am getting the same error. For container apps, we can specify registries via:

registries: [
        {
          server: 'ghcr.io'
          username: user-name
          passwordSecretRef: 'container-registry-password'
        }
      ]

However, for Azure Function apps hosted in ACA, how should we specify the third party registry as there is no property for that? Should I include user name and password in the linuxFxVersion property?

// Kontext function app
resource functionApp 'Microsoft.Web/sites@2022-09-01' = {
  name: functionsAppName
  location: location
  kind: 'functionapp'
  properties: {
    managedEnvironmentId: containerAppEnvironment.id
    siteConfig: {
      linuxFxVersion: 'Docker|ghcr.io/***/***-functions:latest'

containerAppEnvironment is an Azure Container App managed environment.

Also I noticed the template will create a new resource group: ***-container-app-env_FunctionApps_25ac957a-d327-468b-92a8-bc0b7d863bec

I found out the answer by myself through Azure Portal template they are stored in appSettings: ,```

                    {
                        "name": "DOCKER_REGISTRY_SERVER_URL",
                        "value": "[parameters('dockerRegistryUrl')]"
                    },
                    {
                        "name": "DOCKER_REGISTRY_SERVER_USERNAME",
                        "value": "[parameters('dockerRegistryUsername')]"
                    },
                    {
                        "name": "DOCKER_REGISTRY_SERVER_PASSWORD",
                        "value": "[parameters('dockerRegistryPassword')]"
                    },
                    {
                        "name": "WEBSITES_ENABLE_APP_SERVICE_STORAGE",
                        "value": "false"
                    },
rphoon commented 1 year ago

Getting the same error but deploying a new Function App via Azure Portal with a new Container App Environment using a private image from an Azure Container Registry in the same subscription.

{ "status": "Failed", "error": { "code": "BadRequest", "message": "Call to containerApps RP failed!, HttpStatusCode=BadRequest,

davidobrien1985 commented 1 year ago

Getting the same error here. All I get is

      error: Code="Forbidden" Message="Call to containerApps RP failed!, HttpStatusCode=Forbidden, RequestId='8f991533-2f97-4e14-83ff-aa74ebbc3ee8', Uri=<uri>?api-version=2022-11-01-preview, CorrelationId=00000000-0000-0000-0000-000000000000" Details=[{"Message":"Call to containerApps RP failed!, HttpStatusCode=Forbidden, RequestId='8f991533-2f97-4e14-83ff-aa74ebbc3ee8', Uri=<uri>?api-version=2022-11-01-preview, CorrelationId=00000000-0000-0000-0000-000000000000"},{"Code":"Forbidden"},{"ErrorEntity":{"Code":"Forbidden","Message":"Call to containerApps RP failed!, HttpStatusCode=Forbidden, RequestId='8f991533-2f97-4e14-83ff-aa74ebbc3ee8', Uri=<uri>?api-version=2022-11-01-preview, CorrelationId=00000000-0000-0000-0000-000000000000"}}]

I already checked the env vars for the Functions App:


{
          name: "DOCKER_REGISTRY_SERVER_URL",
          value: "<acr>.azurecr.io"
        },
        {
          name: "DOCKER_REGISTRY_SERVER_USERNAME",
          value: "<acr>"
        },
        {
          name: "DOCKER_REGISTRY_SERVER_PASSWORD",
          value: <acrAdminPassword>
        },
JesperNJessen commented 12 months ago

I'm getting the same error when attempting to create a new Function App with a private container registry image in the same resource group. The error details are:

{
  "error": {
    "code": "AuthenticationFailed",
    "message": "Authentication failed. The 'Authorization' header is missing."
  }
}
MarekLani commented 11 months ago

Hello I see same error when trying to pull image from private registry when providing username and password (RP Failed), morover when trying the deployment with bicep and assigning managed identity I am getting error stating: "AcrUseManagedIdentityCreds is not supported for Azure Functions on Azure Container apps" this basically yields azure functions on ACA unusable, please can somebody from Microsoft comment?

chandrod commented 11 months ago

Hello I see same error when trying to pull image from private registry when providing username and password (RP Failed), morover when trying the deployment with bicep and assigning managed identity I am getting error stating: "AcrUseManagedIdentityCreds is not supported for Azure Functions on Azure Container apps" this basically yields azure functions on ACA unusable, please can somebody from Microsoft comment?

ManagedIdentity is not supported in public preview.

chandrod commented 11 months ago

Getting the same error here. All I get is

      error: Code="Forbidden" Message="Call to containerApps RP failed!, HttpStatusCode=Forbidden, RequestId='8f991533-2f97-4e14-83ff-aa74ebbc3ee8', Uri=<uri>?api-version=2022-11-01-preview, CorrelationId=00000000-0000-0000-0000-000000000000" Details=[{"Message":"Call to containerApps RP failed!, HttpStatusCode=Forbidden, RequestId='8f991533-2f97-4e14-83ff-aa74ebbc3ee8', Uri=<uri>?api-version=2022-11-01-preview, CorrelationId=00000000-0000-0000-0000-000000000000"},{"Code":"Forbidden"},{"ErrorEntity":{"Code":"Forbidden","Message":"Call to containerApps RP failed!, HttpStatusCode=Forbidden, RequestId='8f991533-2f97-4e14-83ff-aa74ebbc3ee8', Uri=<uri>?api-version=2022-11-01-preview, CorrelationId=00000000-0000-0000-0000-000000000000"}}]

I already checked the env vars for the Functions App:


{
          name: "DOCKER_REGISTRY_SERVER_URL",
          value: "<acr>.azurecr.io"
        },
        {
          name: "DOCKER_REGISTRY_SERVER_USERNAME",
          value: "<acr>"
        },
        {
          name: "DOCKER_REGISTRY_SERVER_PASSWORD",
          value: <acrAdminPassword>
        },

Deployment is still in progress, I will validate once post deployment and confirm here.

chandrod commented 11 months ago

I'm getting the same error when attempting to create a new Function App with a private container registry image in the same resource group. The error details are:

{
  "error": {
    "code": "AuthenticationFailed",
    "message": "Authentication failed. The 'Authorization' header is missing."
  }
}

I am not sure of this issue, what folks have mentioned is "Call to containerApps RP failed!" and we fixed it and deployment is in progress. Could you please mention how can I reproduce this error ? Thanks

eduards-vavere commented 8 months ago

Still not able to specify a private registry, auth failure

raorugan commented 8 months ago

Updated the docs reg config params needed for private registry - image

https://learn.microsoft.com/en-us/azure/azure-functions/functions-deploy-container-apps?tabs=docker%2Cbash&pivots=programming-language-python#create-and-configure-a-function-app-on-azure-with-the-image

Closing this issue