Deploy React App to Azure Web App - "There is not enough space on the disk"

175 Views Asked by At

I'm trying to deploy my react app for the first time via GitHub Actions, however, I get the following error in the "Deploy to Azure Web App" phase:

Package deployment using ZIP Deploy initiated.

Fetching changes.

Cleaning up temp folders from previous zip deployments and extracting pushed zip file C:\local\Temp\zipdeploy\z0e1gika.zip (191.73 MB) to C:\local\Temp\zipdeploy\extracted

There is not enough space on the disk.\r\n

Error: Failed to deploy web package to App Service.

Error: Deployment Failed, Package deployment using ZIP Deploy failed. Refer logs for more details.

In the "Download Artifact From Build Job" phase, I get a warning that there are over 40,000 files and that I should archive unnecessary files. I have a strong suspicion it is due to this - if so, I'm not sure how I can go about identifying and removing unnecessary files.

I also checked the max storage of my app through AzurePortal, which under File System Storage states that I have a 1 GiB threshold. It seems like even with such a large amount of artifacts, it should still be able to handle it, so I'm not sure what's going on.

1

There are 1 best solutions below

0
On

Thanks @Edison Garcia for the blog.

You can use only the Build folder for deployment on the web app.
which is created from the command available in the .yml file
npm run build --if present

Deployment:

enter image description here

enter image description here

Make changes in the .yml file: path: build/

main_reactappgithub.yml:

name: Build and deploy a Node.js app to the Azure Web App - Reactappgithub

on:  
push:  
branches:  
- main  
workflow_dispatch:

jobs:  
build:  
runs-on: ubuntu-latest

steps:  
- uses: actions/checkout@v4

- name: Set up Node.js version  
uses: actions/setup-node@v3  
with:  
node-version: '18.x'

- name: npm install, build, and test  
run: |  
npm install  
npm run build --if-present  
npm run test --if-present

- name: Upload artifact for deployment job  
uses: actions/upload-artifact@v3  
with:  
name: node-app  
path: build/

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

steps:  
- name: Download artifact from build job  
uses: actions/download-artifact@v3  
with:  
name: node-app

- name: 'Deploy to Azure Web App'  
id: deploy-to-webapp  
uses: azure/webapps-deploy@v2  
with:  
app-name: 'Reactappgithub'  
slot-name: 'Production'  
publish-profile: ${{ secrets.AZUREAPPSERVICE_PUBLISHPROFILE_xxxxxxxxxxxxxxxxxxxxxx }}  
package: .  

enter image description here

enter image description here

After deployment is complete, we need to make changes in the web app configuration as below.

linux

  • Go to configuration -> startup command
  • Add pm2 serve /home/site/wwwroot --spa --no-daemon

enter image description here

Windows:
No changes

OUTPUT:

enter image description here