static-web-apps-cli icon indicating copy to clipboard operation
static-web-apps-cli copied to clipboard

Version 1.1.5 not working in Linux/WSL

Open gabrielmdesidera opened this issue 3 years ago • 13 comments

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/[email protected]
  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):

  • WSL: Ubuntu 22.04.1 LTS, using Node v18.0.0
  • Azure Pipelines: Ubuntu 20.04, not sure which version of Node

gabrielmdesidera avatar Nov 07 '23 16:11 gabrielmdesidera

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

JesseDeH avatar Nov 07 '23 16:11 JesseDeH

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

jancimajek avatar Nov 07 '23 16:11 jancimajek

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 [email protected] that's causing the error - in our logs I can see [email protected] was working.

jimmystridh avatar Nov 07 '23 21:11 jimmystridh

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.

jimmystridh avatar Nov 07 '23 21:11 jimmystridh

@jimmystridh Earlier today I managed to downgrade to version 1.1.4 by running npm install -g @azure/[email protected]. Then the swa deploy command worked.

gabrielmdesidera avatar Nov 07 '23 22:11 gabrielmdesidera

@jimmystridh Earlier today I managed to downgrade to version 1.1.4 by running npm install -g @azure/[email protected]. Then the swa deploy command worked.

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

jimmystridh avatar Nov 07 '23 22:11 jimmystridh

Thanks for the temp fix @gabrielmdesidera

Gaffen avatar Nov 08 '23 10:11 Gaffen

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

nimro avatar Nov 08 '23 10:11 nimro

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

spzm avatar Nov 08 '23 10:11 spzm

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

nimro avatar Nov 08 '23 11:11 nimro

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.

jimmystridh avatar Nov 08 '23 11:11 jimmystridh

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 avatar Nov 08 '23 12:11 cjk7989

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.

cjk7989 avatar Nov 08 '23 16:11 cjk7989