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,620 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://learn.microsoft.com/en-us/azure/static-web-apps/static-web-apps-cli-deploy https://learn.microsoft.com/en-us/azure/static-web-apps/troubleshooting.
- Ensure the
-
Shree Hima Bindu Maganti 1,620 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,620 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,620 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,620 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.
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. -
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.
-
Shree Hima Bindu Maganti 1,620 Reputation points • Microsoft Vendor
2024-12-30T17:16:04.2033333+00:00 Hi James Pierce
,Thank you for your kind words, and I’m glad the previous guidance was helpful .please click ACCEPT ANSWER and kindly upvote it so that other people who faces similar issue may get benefitted from it. -
James Pierce 0 Reputation points
2024-12-30T17:50:04.1766667+00:00 Hi @Shree Hima Bindu Maganti ,
The previous guidance was helpful and resolved the error code I had initially, I am still unable to deploy my code to the website so my issue is still unresolved. I posted the new error that is preventing my site from deploying above.
-
Shree Hima Bindu Maganti 1,620 Reputation points • Microsoft Vendor
2024-12-30T17:59:16.2333333+00:00 Hi James Pierce,
Thank you for your response.
Could you please provide detailed information about the error you're encountering, including the exact issue and the context in which it occurs? This will help us understand the problem better and provide an appropriate solution. -
James Pierce 0 Reputation points
2024-12-30T18:52:35.8+00:00 Hi @Shree Hima Bindu Maganti ,
After running the command
swa deploy --output-location . --env Production --api-language none --api-version none --verbose > deployment-log.txt 2>&1
I received an error. This is what it gives me as output:
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: [] }
My azure web portal still says the website is waiting for deployment, so it's not going through still.
I am currently configured with NVM version 1.1.12, npm version 10.9.0, and node version 22.12.0.
-
Shree Hima Bindu Maganti 1,620 Reputation points • Microsoft Vendor
2025-01-02T19:01:08.72+00:00 Hi James Pierce,
Thank you for your response.
The error suggests the Azure Static Web Apps CLI (SWA CLI) deployment is failing due to deprecation warning related to thepunycode
module, which is part of Node.js.A
MODULE_NOT_FOUND
error, indicating the deployment script or path might be misconfigured.The use of Node.js version 22.12.0, which is not yet fully stable or supported by SWA CLI.
Using NVM, switch to the latest LTS version of Node.js (e.g., 18.x or 20.x)
nvm install 20
nvm use 20
Confirm the Node.js and npm versions
node --version
npm --version
Remove the existing SWA CLI and reinstall it to ensure compatibility.
npm uninstall -g @azure/static-web-apps-cli
npm install -g @azure/static-web-apps-cli
Ensure the project path is correct and contains the necessaryindex.html
file.Check the
swa-cli.config.json
file for valid settings and paths.Deploy using the updated Node.js version
swa deploy --output-location . --env Production --api-language none --api-version none --verbose
Capture detailed logs.
swa deploy --output-location . --env Production --api-language none --api-version none --verbose > deployment-log.txt 2>&1
Thenode --trace-deprecation ...
command was incomplete. Instead, run
node --trace-deprecation node_modules/@azure/static-web-apps-cli/lib/index.js
This will help trace the exact source of the warning.In the Azure portal, go to the Activity Log of your Static Web App to identify additional deployment errors or messages.
If the issue persists, share the updated logs fromdeployment-log.txt
for further investigation. Let us know if you need assistance. -
Shree Hima Bindu Maganti 1,620 Reputation points • Microsoft Vendor
2025-01-06T17:47:45.0533333+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
2025-01-06T18:36:42.1+00:00 Hi Shree,
More progress however still not a working solution.
After installing using the
nvm install 20
andnvm use 20
commands, reinstalling the cli command with the commands mentioned, validating the config file, and re-running the deploy command with output to a text file I get the following:Welcome to Azure Static Web Apps CLI (2.0.2) 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... node.exe : - Preparing deployment. Please wait... At C:\Program Files\nodejs\swa.ps1:16 char:5 + & "$basedir/node$exe" "$basedir/node_modules/@azure/static-web-a ... + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : NotSpecified: (- Preparing deployment. Please wait...:String) [], RemoteException + FullyQualifiedErrorId : NativeCommandError
Still errors on the same line/character in swa.ps1, however it no longer says its related to punycode.
When I run the longer trace command you mentioned to use, I get:
PS C:\Users\James\Documents\LiL Test Project> node --trace-deprecation node_modules/@azure/static-web-apps-cli/lib/index.js node:internal/modules/cjs/loader:1228 throw err; ^ Error: Cannot find module 'C:\Users\James\Documents\LiL Test Project\node_modules\@azure\static-web-apps-cli\lib\index.js' at Module._resolveFilename (node:internal/modules/cjs/loader:1225:15) at Module._load (node:internal/modules/cjs/loader:1051:27) at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:173:12) at node:internal/main/run_main_module:28:49 { code: 'MODULE_NOT_FOUND', requireStack: [] } Node.js v20.18.1
It can't seem to find the index.js file the command is looking for. When I look in the node_modules/@azure folder, it appears to be empty.
Sorry to be such a hassle, this run-around has me scratching my head.
-
Shree Hima Bindu Maganti 1,620 Reputation points • Microsoft Vendor
2025-01-09T17:39:52.95+00:00 Hi James Pierce,
Apologies for the delayed responses. Thank you for your patience.
It seems that even after reinstalling the required tools, the problem persists. TheMODULE_NOT_FOUND
error suggests that the installation of the@azure/static-web-apps-cli
package is still incomplete or corrupted, which is likely why thenode_modules/@azure/static-web-apps-cli/lib/index.js
file is missing.- Run the following command to ensure the npm cache is clean
npm cache clean --force
- Uninstall the Azure Static Web Apps CLI if it's already installed
npm uninstall -g @azure/static-web-apps-cli
- Reinstall the CLI
npm install -g @azure/static-web-apps-cli
- After reinstalling, verify if
@azure/static-web-apps-cli
was correctly installed by checking the globalnode_modules
folder.npm root -g
- Look for the
@azure/static-web-apps-cli
directory in that folder. - If the error persists, it might help to install the CLI package locally in your project. Navigate to your project folder.
cd "C:\Users\James\Documents\LiL Test Project"
- Run the following command to install the package.
npm install @azure/static-web-apps-cli --save-dev
Once installed, check if the fileindex.js
exists under thenode_modules/@azure/static-web-apps-cli/lib
folder. - You can try running the deployment command again with the trace flag to get a clearer picture of the issue.
node --trace-deprecation node_modules/@azure/static-web-apps-cli/lib/index.js
If this doesn't resolve the issue, it may be helpful to share any new errors you encounter or details about the folder structure.
- Run the following command to ensure the npm cache is clean
-
Shree Hima Bindu Maganti 1,620 Reputation points • Microsoft Vendor
2025-01-10T18:06:30.9466667+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.
Sign in to comment