The Static Web App contents cannot be updated while a backend migration is in progress

Robert Balfre 10 Reputation points
2024-04-07T21:06:55.88+00:00

When attempting to deploy via an Azure DevOps pipeline or the SWA cli we get the error:

The content server has rejected the request with: BadRequest
Reason: The Static Web App contents cannot be updated while a backend migration is in progress.

It was working fine for months until we added an API (Azure managed), first deployment worked and then all deployment since have failed with this error message.

Azure Static Web Apps
Azure Static Web Apps
An Azure service that provides streamlined full-stack web app development.
766 questions
{count} vote

3 answers

Sort by: Most helpful
  1. Punyasloka Parida 0 Reputation points
    2024-04-23T07:27:36.46+00:00

    I have encountered the same issue. This is what i have done to fix it. It's a bit lengthy but does the job.

    • Delete the existing app through azure cli (or create a new one - step 2).

    az staticwebapp delete--name <app_name> -g <resource_group>

    • Create a new app with no github integration etc.

    az staticwebapp create --name <app_name> -g <resource_group>

    • Fetch the deployment token using the following command

    az staticwebapp secrets list --name <app_name> --query "properties.apiKey"

     - name: Install Azure SWA CLI
       run: npm install -g @azure/static-web-apps-cli
    
     - name: Deploy 
       run: |
          swa deploy <app_location> \
          --api-location <api_location> \
          --env <env> \
          --deployment-token <deployment_token> \ 
          -name <name_of_the_app>
    

    Note: You can use the the official github action - Azure/static-web-apps-deploy@ to do deployment too but i haven't tested it. So, cannot confirm if it will work. I prefer this way.


  2. Mitali Karmarkar 0 Reputation points Microsoft Employee
    2024-04-23T17:30:38.17+00:00

    We have identified the issue and are working on a mitigation strategy. I apologize for any inconvenience that this may have caused.

    0 comments No comments

  3. ajkuma 22,416 Reputation points Microsoft Employee
    2024-04-30T07:26:22.27+00:00

    To provide an update:

    Our product engineering team rolled out a fix to address this issue. 

    We request you to re-try the operation and let us know.

    @Robert Balfre and everyone, thanks for reporting this issue.
    We appreciate your patience through this mitigation.


    Please click Accept Answer -it will benefit users to find the answers quickly

    0 comments No comments