SWA CLI - Deploying web app does not push the files to the actual site

James Pierce 20 Reputation points
2024-12-16T16:20:17.24+00:00

I am attempting to use the SWA CLI to push code to a static web app (mainly because the free tier of devops is currently locked until the new year) however it does not appear to be working correctly for me.

My website is a simple index.html file with some html/css included. I have it in the "." directory of the project folder.

The command line says it was able to deploy project, but nothing changes and the home page says it is still waiting for deployment.LiL Portal

LiL Project Files

LiL PowerShell

I did initially have issues getting the SWA CLI working, but after getting the "az" command installed I was able to login to "az" and login to "swa" which I assume is working as intended at this point.

I'm not sure how to proceed as it says it's working but clearly isn't pushing anything up, is there a log file somewhere I should reference for more information?

Azure Static Web Apps
Azure Static Web Apps
An Azure service that provides streamlined full-stack web app development.
1,050 questions
{count} votes

Accepted answer
  1. Shree Hima Bindu Maganti 2,185 Reputation points Microsoft Vendor
    2025-01-15T13:53:27.11+00:00

    Hi James Pierce,
    Thank you for sharing the final update and the detailed steps you followed to resolve the issue. I’m glad to hear that everything is working as expected on your secondary machine now! I appreciate your patience and effort in troubleshooting and documenting the process.

    1. Install Node Version Manager (NVM):
      • Installed Node Version Manager for managing Node.js versions (NVM Installation Guide).
      • Used nvm install 20 to install Node.js version 20 and the relevant npm version.
      • Used nvm use 20 to set Node.js version 20 as the active version.
    2. Install Azure Static Web Apps CLI (SWA):
      • Ran npm install -g @azure/static-web-apps-cli to globally install the Static Web Apps CLI.
    3. Install Azure CLI:
    4. Login to Azure and SWA:
      • Used az login to log in to the Azure tenant, ensuring 2FA authentication was completed.
      • Ran swa login to log in to the Azure Static Web Apps CLI and synchronize it with the Azure account.
    5. Generate SWA Configuration File:
      • Executed the swa command to generate a new configuration file (swa-cli.config.json) for the project.
    6. Prepare the Deployment Folder:
      • Identified and resolved the "Current directory cannot be identical to or contained within artifact folders" error by navigating up one directory and specifying the correct output folder.
    7. Deploy the Project:
      • Used the following command for the final deployment.
        swa deploy --output-location . --env Production --api-language none --api-version none --verbose -a ./TestWebApp
    8. Key flags included:
      • --env Production to deploy to the correct environment.
      • --output-location . to specify the folder containing the deployment files.
      • -a ./TestWebApp to avoid directory structure conflicts.
    9. Clean Up:
      • Removed the unnecessary node_modules folder from the project directory to resolve a space issue (284MB). It had no impact on the functionality. I’m happy we could work together to navigate the challenges, and I’m truly grateful for your detailed feedback and updates throughout the process. If you encounter any further issues or need assistance in the future, feel free to reach out! Thank you again for allowing me to assist you with this.
        If the answer is helpful, please click Accept Answer and kindly upvote it so that other people who faces similar issue may get benefitted from it.
    1 person found this answer helpful.
    0 comments No comments

0 additional answers

Sort by: Most helpful

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.