Function App 503

Casey 50 Reputation points
2024-07-03T14:00:08.2866667+00:00

I recently switched my function apps to run in containers, however now they return a 503 error when I try to send them a request.

My Dockerfile is:


FROM mcr.microsoft.com/azure-functions/python:4-python3.9

ENV AzureWebJobsScriptRoot=/home/site/wwwroot \
    AzureFunctionsJobHost__Logging__Console__IsEnabled=true

# Install Tesseract OCR and poppler-utils
RUN apt-get update && \
    apt-get install -y tesseract-ocr poppler-utils

COPY requirements.txt /
RUN pip install -r /requirements.txt

COPY . /home/site/wwwroot

And here's the deploy job in my github workflow .yml

  deploy:
    needs: build
    runs-on: ubuntu-latest
    environment:
      name: Production
      url: ${{ steps.deploy-to-function.outputs.app-url }}

    steps:
      - name: "Login via Azure CLI"
        uses: azure/login@v1
        with:
          creds: ${{ secrets.AZURE_CREDENTIALS }}

      - name: Checkout repository
        uses: actions/checkout@v4

      - name: Set up Docker Buildx
        uses: docker/setup-buildx-action@v2

      - name: Log in to Azure Container Registry
        uses: azure/docker-login@v1
        with:
          login-server: ${{ env.AZURE_CONTAINER_REGISTRY }}
          username: ${{ vars.ACR_USERNAME }}
          password: ${{ secrets.ACR_PASSWORD }}

      - name: Build and push Docker image
        uses: docker/build-push-action@v4
        with:
          context: .
          file: ./Dockerfile
          push: true
          tags: ${{ env.AZURE_CONTAINER_REGISTRY }}/${{ env.AZURE_FUNCTIONAPP_NAME }}:${{ github.sha }}

      - name: Deploy to Azure Functions
        uses: Azure/functions-container-action@v1
        with:
          app-name: ${{ env.AZURE_FUNCTIONAPP_NAME }}
          image: ${{ env.AZURE_CONTAINER_REGISTRY }}/${{ env.AZURE_FUNCTIONAPP_NAME }}:${{ github.sha }}

      - name: Azure logout
        run: |
          az logout

The action completes, however it raises a warning at this step:

Run Azure/functions-container-action@v1
  with:
    app-name: doc-ai-2-dev
    image: docai2.azurecr.io/doc-ai-2-dev:78719c4938d9ffc7a2033fd41c45435003d7d7f8
  env:
    AZURE_FUNCTIONAPP_PACKAGE_PATH: .
    AZURE_FUNCTIONAPP_NAME: doc-ai-2-dev
    AZURE_CONTAINER_REGISTRY: docai2.azurecr.io
    PYTHON_VERSION: 3.9
    DOCKER_CONFIG: /home/runner/work/_temp/docker_login_1720013361725
Updating App Service Configuration settings. Data: ***"linuxFxVersion":"DOCKER|docai2.azurecr.io/doc-ai-2-dev:78719c4938d9ffc7a2033fd41c45435003d7d7f8"***
Updated App Service Configuration settings.
Restarting app service: doc-ai-2-dev
Deployment passed
Restarted app service: doc-ai-2-dev
Warning: Failed to sync function triggers in function app. Trigger listing may be out of date.
Warning: Error: Failed to update deployment history.
Site Unavailable (CODE: 503)
Azure Function App URL: http://doc-ai-2-dev.azurewebsites.net

Any clues as to what I might need to get this working?

Azure Functions
Azure Functions
An Azure service that provides an event-driven serverless compute platform.
5,115 questions
{count} votes

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.