Azure / static-web-apps-cli

Azure Static Web Apps CLI ✨
https://aka.ms/swa/cli-local-development
MIT License
583 stars 110 forks source link

Version 1.1.5 not working in Linux/WSL #776

Closed gabrielmdesidera closed 7 months ago

gabrielmdesidera commented 7 months ago

Describe the bug When running the command swa deploy, an error occurs during the deploy. This error occurs only in version 1.1.5 in Linux/WSL. The same SWA CLI version works fine in Windows, and versions 1.1.4 and below work fine in Linux/WSL.

To Reproduce Steps to reproduce the behavior:

  1. Install version 1.1.5: npm install -g @azure/static-web-apps-cli@1.1.5
  2. Type in command 'swa deploy ...'
  3. See error
Welcome to Azure Static Web Apps CLI (1.1.5)

⠋ Preparing deployment. Please wait...(node:468) [DEP0147] DeprecationWarning: In future versions of Node.js, fs.rmdir(path, { recursive: true }) 
will be removed. Use fs.rm(path, { recursive: true }) instead
(Use `node --trace-deprecation ...` to show where the warning was created)
✖ An unknown exception has occurred

Expected behavior

Welcome to Azure Static Web Apps CLI (1.1.4)

✔ Project deployed to https://xxxxxxxxxxx.azurestaticapps.net 🚀

Screenshots Azure Pipelines: image (7)

Desktop (please complete the following information):

JesseDeH commented 7 months ago

+1 also getting this error when deploying from a Linux agent.

jancimajek commented 7 months ago

+1 Also getting the same error when deploying from Linux runner (using Octopus deploy, although I don't think that's relevant)

jimmystridh commented 7 months ago

Also getting the same error on both MacOS and Linux and no way of running an older version (!).

To be clear it seems like it's StaticSitesClient@1.0.024941 that's causing the error - in our logs I can see StaticSitesClient@1.0.024841 was working.

jimmystridh commented 7 months ago

for anyone needing a workaround I published my repo locally, created a new gitrepo and pushed the static build to that, created a new static web app and used this git repo, got a deployment token for my actual static web app using swa deploy --print-token and then switched the repo secret to this new key and re-ran the github action.

Did this in a bit of a rush so there's hopefully a less convoluted way to deploy with the broken swa cli out there. Directly using the docker container in https://github.com/Azure/static-web-apps-deploy was on the list as well.

gabrielmdesidera commented 7 months ago

@jimmystridh Earlier today I managed to downgrade to version 1.1.4 by running npm install -g @azure/static-web-apps-cli@1.1.4. Then the swa deploy command worked.

jimmystridh commented 7 months ago

@jimmystridh Earlier today I managed to downgrade to version 1.1.4 by running npm install -g @azure/static-web-apps-cli@1.1.4. Then the swa deploy command worked.

interesting, will give that a try in case I need to deploy again before this is fixed, thanks!

Gaffen commented 7 months ago

Thanks for the temp fix @gabrielmdesidera

nimro commented 7 months ago

Seeing this too on Ubuntu 22.04.3. Can confirm downgrading to 1.1.4 is a valid workaround, thanks @gabrielmdesidera

spzm commented 7 months ago

I confirm the same issue on MacOS 14 (Sonoma) with 1.1.5, rollback to 1.1.4 fixed the issue. thanks @gabrielmdesidera

nimro commented 7 months ago

Worse, the swa cli exits 0 (success) after printing this error 🤦 image

jimmystridh commented 7 months ago

Worse, the swa cli exits 0 (success) after printing this error 🤦 image

Yup, our CI builds were passing so this went unnoticed for a while until it was noticed the frontend wasn't up-to-date, not great.

cjk7989 commented 7 months ago

Hello all, We have identified and confirmed the issue on Linux. It is caused by the child_process.spawn() function, which swa-cli uses to execute the StaticSiteClient binary. This function behaves differently on Windows and Linux. We are working on a fix and will update as soon as possible. Thank you for your advices and apologise for the inconvenience.

cjk7989 commented 7 months ago

Hello all, We have identified and confirmed the issue on Linux. It is caused by the child_process.spawn() function, which swa-cli uses to execute the StaticSiteClient binary. This function behaves differently on Windows and Linux. We are working on a fix and will update as soon as possible. Thank you for your advices and apologise for the inconvenience.

We have released version 1.1.6. Thanks for your patience and support, and please let me know if there are any other problems.