SWA CLI - Deploying web app does not push the files to the actual site
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.
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
-
Shree Hima Bindu Maganti 1,585 Reputation points • Microsoft Vendor
2024-12-16T18:32:33.8266667+00:00 Hi James Pierce,
Welcome to the Microsoft Q&A Platform!
The issue is Static Web App CLI Deployment Fails to Update Site,while the deployment process succeeds (swa deploy
shows success), the Azure Static Web App site remains in "Waiting for deployment" state due to some environment configuration.- Ensure the
--env
flag is correctly pointing to the desired environment (production
in your case.swa deploy --env production
- Ensure the folder containing
index.html
is the root deployment directory currently.
in folder. - Use the
--output-location
flag to explicitly set the output folder if necessary.swa deploy --output-location .
- Open the Azure Portal → Static Web Apps → Your App → GitHub Actions / Deployment Logs.
- Review the deployment logs to identify errors or missing steps.
- Verify your Azure authentication session is active.
az account show
- If needed, re-authenticate.
az login
- Sometimes, cached settings or configurations may cause deployment issues.
- Reset the SWA CLI configuration by deleting the
.swa
or.swa-cli.config.json
file and rerunning.swa init
swa deploy
- Confirm the
index.html
file is uploaded to the production endpoint. - Use tools like
curl
or browser developer tools to confirm file content matches the local copy. - Add
--verbose
to theswa deploy
command for detailed logs.swa deploy --env production --verbose
- Logs are displayed directly in the CLI output. https://zcusa.951200.xyz/en-us/azure/static-web-apps/static-web-apps-cli-deploy https://zcusa.951200.xyz/en-us/azure/static-web-apps/troubleshooting.
- Ensure the
-
Shree Hima Bindu Maganti 1,585 Reputation points • Microsoft Vendor
2024-12-17T17:53:35.5+00:00 Hi James Pierce,
Following up to see if you have chance to check my previous response and help us with requested information is helpful.
-
James Pierce 0 Reputation points
2024-12-17T20:44:42.2166667+00:00 Hi Shree, thanks for the feedback.
- As seen in my screenshots I do use the "--env production" flag.
- As seen in my screenshots, index.html is in the main folder, the one I run the "swa deploy ..." from. There are no sub-folders to the project.
- I can add this, my understanding is that output-location is needed if you have to build a project, and this shouldn't need that? I'll try adding it anyways.
- After following the first steps, I do not have a "Github / Deployment Logs" section. I have an "Activity Log" option. I've included screenshots of the options I see in the list below my response.
- N/A
- Running this command in powershell shows me details about my Azure account and subscription, nothing looks out of place. I won't screenshot that as I don't know what if anything in that would be considered sensitive data.
- N/A
- How would I deal with this? This is the first ever project I've attempted to run with SWA CLI so I don't think it ought to be a cached error, but I don't mind running extra steps to be sure.
- I have tried clearing the .swa-config file a couple of times through this process and it continues to not work as expected.
- How do I do this?
- I'm familiar with using curl to scrape websites, so once I know it's actually showing on the page I can run that against the url I have. I won't be able to do this until it shows on the page though, and currently it takes me to the default "Congratulations on your new site" page.
- I will run it with verbose logging and see if it gives any new info.
- I included a screenshot of the CLI output and it really doesn't include anything useful in regards to the issue I'm experiencing unfortunately. I'll try again with the "--verbose" and see what comes of that.
-
James Pierce 0 Reputation points
2024-12-17T20:45:37+00:00 While running the deployment with --output-location and --verbose there are a couple of messages that flash on the screen incredibly briefly before disappearing.
"Preparing deployment. Please Wait ..."
"DeploymentId: <insert ID here>""Could not get event info. Proceeding" a couple of times, I think. It's hard to tell if it's one long one or a couple of short ones due to some flashing on this message.
I had to record my screen to actually see what the messages were, they happen in under a second.
-
Shree Hima Bindu Maganti 1,585 Reputation points • Microsoft Vendor
2024-12-20T16:12:25.59+00:00 Hi James Pierce
Thankyou for Your Response.
During the Azure Static Web Apps (SWA CLI) deployment process, a transient issue occurs with the message was Could not get event info. Proceeding. This may cause a temporary delay or incomplete deployment.
The issue may be happened A network instability during the deployment process. Service latency in the Azure region being used. A misconfigured deployment folder or output location.
To reslove this to verify the configuration.
Ensure the--output-location
flag points to the correct build folder (e.g.,/dist
for Angular,/build
for React).If unsure, use the default deployment.
swa deploy --env production --verbose
Retry the deployment to address temporary network or latency issues.Use verbose logging to capture additional details.
swa deploy --output-location <path> --verbose > deployment-log.txt 2>&1
Ensure there is no interruption in the internet connection during the deployment.Go to the Activity Log in the Azure portal to check for detailed deployment events or errors.
Remove cached configurations with the following command.
rm -rf .swa-config
swa deploy --verbose
Ensure you are using the latest versions of Azure CLI
az --versionswa --version
If the issue their, share the deployment logs for further analysis. -
Shree Hima Bindu Maganti 1,585 Reputation points • Microsoft Vendor
2024-12-23T18:59:28.63+00:00 Hi James Pierce
Following up to see if you have chance to check my previous response and help us with requested information is helpful.
-
James Pierce 0 Reputation points
2024-12-24T15:49:18.9666667+00:00 Hi Shree,
Using the command that spits all output into a text file has resulted in a new error message. It looks like there is an issue with the swa package to do with node? I'm aware that node and npm are javascript package management things, but my current project is html only so I'm not sure why it would be failing in this way. I've attached the text of the message below.
Welcome to Azure Static Web Apps CLI (2.0.1) Using configuration "li-l-test-project" from file: C:\Users\James\Documents\LiL Test Project\swa-cli.config.json Deploying front-end files from folder: C:\Users\James\Documents\LiL Test Project Consider providing api-language and version using --api-language and --api-version flags, otherwise default values apiLanguage: node and apiVersion: 16 will apply Checking Azure session... Γ£ö Successfully logged into Azure! Checking project "StaticHomePage" settings... Γ£ö Successfully setup project! Deploying to environment: production Deploying project to Azure Static Web Apps... node.exe : - Preparing deployment. Please wait... At C:\Users\James\AppData\Roaming\npm\swa.ps1:24 char:5 +
& "node$exe" "$basedir/node_modules/@azure/static-web-apps-cli/d ...
> ```xml ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- CategoryInfo : NotSpecified: (- Preparing deployment. Please wait...:String) [], RemoteException
- FullyQualifiedErrorId : NativeCommandError
-
Shree Hima Bindu Maganti 1,585 Reputation points • Microsoft Vendor
2024-12-27T08:01:10.2033333+00:00 Hi James Pierce
Thankyou for Your Response.
The deployment failed due to a Node.js dependency issue in the Azure Static Web Apps CLI (SWA CLI). While your project is HTML-only, the SWA CLI uses Node.js internally for deployment.
The error indicates that the SWA CLI defaulted to using Node.js v16, which might be incompatible or missing from your system.Node.js or npm (Node Package Manager) isn't installed correctly.
There's a mismatch between the Node.js version required by SWA CLI and the one installed.
Download and install the latest LTS version of Node.js from the. This ensures compatibility with the SWA CLI.node --version npm --version
Update the Azure Static Web Apps CLI to the latest version to ensure compatibility
npm install -g @azure/static-web-apps-cli
Confirm the CLI version
swa --version
Since your project is HTML-only, override the default API settings.
swa deploy --output-location <path> --api-language none --api-version none --verbose
If the issue persists, clear the npm cache and reinstall the SWA CLInpm cache clean --force npm install -g @azure/static-web-apps-cli
After completing the above steps, try deploying again.
swa deploy --output-location <path> --verbose
If the issue persists, share the updated error logs for further analysis. Let us know if you need assistance with Node.js or the deployment process. -
James Pierce 0 Reputation points
2024-12-27T15:42:32.4833333+00:00 Hi @Shree Hima Bindu Maganti ,
After what turned out to be a large amount of effort and fiddling, I was able to get NVM, NPM, and Node installed / updated and co-existing so that everything had version numbers sufficient to resolve the previous problem.
After running the command
swa deploy --output-location . --env Production --api-language none --api-version none --verbose > deployment-log.txt 2>&1
I received a new error.
Welcome to Azure Static Web Apps CLI (2.0.2) node.exe : (node:4844) [DEP0040] DeprecationWarning: The `punycode` module is deprecated. Please use a userland alternative instead. At C:\Program Files\nodejs\swa.ps1:16 char:5 + & "$basedir/node$exe" "$basedir/node_modules/@azure/static-web-a ... + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : NotSpecified: ((node:4844) [DE...native instead.:String) [], RemoteException + FullyQualifiedErrorId : NativeCommandError (Use `node --trace-deprecation ...` to show where the warning was created) Using configuration "li-l-test-project" from file: C:\Users\James\Documents\LiL Test Project\swa-cli.config.json Deploying front-end files from folder: C:\Users\James\Documents\LiL Test Project Checking Azure session... Γ£ö Successfully logged into Azure! Checking project "StaticHomePage" settings... Γ£ö Successfully setup project! Deploying to environment: Production Deploying project to Azure Static Web Apps... - Preparing deployment. Please wait...
I used the node --trace-deprecation ... command and get this:
PS C:\Users\James\Documents\LiL Test Project> node --trace-deprecation ... node:internal/modules/cjs/loader:1252 throw err; ^ Error: Cannot find module 'C:\Users\James\Documents\LiL Test Project\...' at Function._resolveFilename (node:internal/modules/cjs/loader:1249:15) at Function._load (node:internal/modules/cjs/loader:1075:27) at TracingChannel.traceSync (node:diagnostics_channel:322:14) at wrapModuleLoad (node:internal/modules/cjs/loader:219:24) at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:170:5) at node:internal/main/run_main_module:36:49 { code: 'MODULE_NOT_FOUND', requireStack: [] }
I'm unsure of how to proceed from here as it's telling me a module cannot be found, but doesn't seem to say which one?
-
James Pierce 0 Reputation points
2024-12-27T16:22:03.4+00:00 Ignore this comment. Issues with previous comment not appearing for me.
Sign in to comment