reactjsazureazure-web-app-servicevitersync

RSYNC error while deploying a Vite+React App to Azure WebApps


I have a Vite+React app using Vite React template. The app is hosted in a Azure WebApp service and the very 1st deployment after the WebApp is created in Azure, goes fine without any issues.

Every 2nd deployment however, I end up with the error, as below.

2025-04-09T08:01:10.8417387Z dist/assets/react-router-BjM9WsHm.js                 73.52 kB │ gzip: 25.26 kB
2025-04-09T08:01:10.8417677Z dist/assets/react-dom-CNorE7jC.js                   172.91 kB │ gzip: 54.59 kB
2025-04-09T08:01:10.8511884Z dist/assets/antd-sjLrhPq3.js                        232.40 kB │ gzip: 63.18 kB
2025-04-09T08:01:10.8512157Z ✓ built in 19.74s
2025-04-09T08:01:10.8512207Z 
2025-04-09T08:01:10.8724779Z Zipping existing node_modules folder...
2025-04-09T08:01:33.3231623Z ..................
2025-04-09T08:01:33.3232164Z Done in 23 sec(s).
2025-04-09T08:01:33.3507631Z Preparing output...
2025-04-09T08:01:33.3533450Z 
2025-04-09T08:01:33.3554629Z Copying files to destination directory '/home/site/wwwroot'...
2025-04-09T08:01:34.3062255Z rsync: [receiver] rename "/home/site/wwwroot/dist/.index.html.qY0R0W" -> "dist/index.html": No such file or directory (2)
2025-04-09T08:01:34.6658689Z rsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1338) [sender=3.2.7]

Earlier, I wasnt using a Chunking strategy for my app and my build file (.js) was 871kb+. Some posts suggested that this size was a reason for this error. So I applied a chunking strategy and no build file is more than 250kb. But the error still exists...

I am struggling with this for more than 9 months now both while deploying from GitHub actions or direct deployment via VS Code.

ATM this moment, every time I have to deploy a new version, I delete the existing WebApp and create it again (then the deployment works). But this is time consuming and not a good way of handling deployments.

Anybody has any idea why this is happening?

Thanks in advance...


Solution

  • To resolve the issue, try to upgrade to higher App Service plans, if you are using Free or Basic plans.

    Before redeploying, try to delete the wwwroot folder by adding the below script in the GitHub workflow file.

    - name: Clean existing wwwroot
      uses: azure/appservice-settings@v1
      with:
        app-name: <WebAppName>
        slot-name: 'production'
        settings: |
          SCM_DO_BUILD_DURING_DEPLOYMENT=true
    - name: Clean wwwroot via Kudu
      run: |
        curl -X POST "https://<WebAppName>.scm.azurewebsites.net/api/command" \
             -u ${{ secrets.KUDU_USERNAME }}:${{ secrets.KUDU_PASSWORD }} \
             -H "Content-Type: application/json" \
             -d '{"command": "rm -rf /home/site/wwwroot/*"}'
    

    You can also manually delete the wwwroot folder in Kudu console by using the below URL.

    https://<AzureWebAppName>.scm.canadacentral-01.azurewebsites.net/newui/fileManager#
    

    enter image description here