Azure / static-web-apps

Azure Static Web Apps. For bugs and feature requests, please create an issue in this repo. For community discussions, latest updates, kindly refer to the Discussions Tab. To know what's new in Static Web Apps, visit https://aka.ms/swa/ThisMonth
https://aka.ms/swa
MIT License
318 stars 53 forks source link

Intermittent 503's #1464

Open danbasszeti opened 1 month ago

danbasszeti commented 1 month ago

For a few days now we have started to observe intermittent 503 errors in all 3 of our main Azure Static Web Apps. The errors seem to come in brief bursts around cold starts, but weirdly requests before them and after them will succeed so its not purely the function app not running yet.

We recently updated everything to .NET 8, and switched on ReadyToRun publishing. We are deploying using the SWA CLI to allow us to build on the windows GitHub agent.

Steps to reproduce the behavior:

  1. Create a .NET 8 function app with readytorun enabled
  2. Create the github actions file to deploy the function app to azure static web apps
  3. When the app first starts up, a few requests respond with 503's

My github action: ` - name: 'Build all the things' shell: bash run: | cd Product cd Product.Api dotnet publish -c Release -r win-x64 -o ./output & cd .. cd .. cd ./Product.Components npm install && npm run build & cd .. cd ./Product npm install && npm run build & cd .. npm install -g @azure/static-web-apps-cli sleep 10

  - name: Azure Login
    uses: Azure/login@v1
    with:
      creds: ${{ secrets.AZURE_CREDENTIALS }}
      enable-AzPSSession: false
      environment: azurecloud
  - name: Deploy site with Azure Static Web Apps CLI
    run: |
      cd AssetOperatorPortal
      swa deploy ./dist --api-language "dotnetisolated" --api-version "8.0" --swa-config-location ./ --api-location ./Product.Api/output --app-name swa${{ env.PRODUCT_NAME }}${{ env.ENV_CODE }} --tenant-id ${{env.TENANT_ID}} --subscription-id ${{env.SUBSCRIPTION_ID}} --env Production --deployment-token $(az staticwebapp secrets list --name swa${{ env.PRODUCT_NAME }}${{ env.ENV_CODE }} --query "properties.apiKey" | xargs)`

Expected behavior No 503's should be fired on start

image