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

Flaky CLI deployment

Open rhuanbarreto opened this issue 1 year ago • 3 comments

Describe the bug

I'm using the CLI to manually deploy the websites in CI. But the process is flaky. It throws an error (spawn ETXTBSY) which means in some sources that the file descriptor is being accessed from two different processes, therefore throwing an error. Rerunning it sometimes solves the problem. But this is very flaky.

Console output:

Welcome to Azure Static Web Apps CLI (1.1.6)

Using configuration "app" from file:
  swa-cli.config.json

Deploying front-end files from folder:
/home/runner/work/typescript/typescript/packages/xxxxx/dist
Deploying to environment: pr19

Found configuration file:
  /home/runner/work/typescript/typescript/packages/xxxxx/staticwebapp.config.json

Deploying project to Azure Static Web Apps...
Could not find StaticSitesClient local binary
- Downloading https://swalocaldeploy.azureedge.net/downloads/1.0.025241/linux/[email protected]
[swa] ✔ Downloading https://swalocaldeploy.azureedge.net/downloads/1.0.025241/linux/[email protected]
- Preparing deployment. Please wait...
✖ 
✖ Deployment Failed :(
✖ Deployment Failure Reason: spawn ETXTBSY
✖ For further information, please visit the Azure Static Web Apps documentation at https://docs.microsoft.com/azure/static-web-apps/

✖ If you believe this behavior is unexpected, please raise a GitHub issue at:
  https://github.com/Azure/static-web-apps-cli/issues/new/choose

To Reproduce Steps to reproduce the behavior:

Run swa deploy --no-use-keychain --app-location "." --config-name "app" --output-location "dist" --env pr19 in Github Actions

Expected behavior

To work every time the command is run

rhuanbarreto avatar Feb 05 '24 13:02 rhuanbarreto

Same/Similar problem here. I am using the CLI inside a docker container from the image: swacli/static-web-apps-cli:latest

Running inside the container running locally is fine. Running from the same image inside a Bitbucket pipeline fails every time.

+ swa deploy --deployment-token $SWA_CLI_DEPLOYMENT_TOKEN --app-location . --output-location build --env production
Welcome to Azure Static Web Apps CLI (1.1.7)
Deploying front-end files from folder:
  /opt/atlassian/pipelines/agent/build/build
Consider providing api-language and version using --api-language and --api-version flags,
    otherwise default values apiLanguage: node and apiVersion: 16 will apply
Deploying to environment: production
Deploying project to Azure Static Web Apps...
Could not find StaticSitesClient local binary
- Downloading https://swalocaldeploy.azureedge.net/downloads/1.0.026361/linux/[email protected]
[swa] ✔ Downloading https://swalocaldeploy.azureedge.net/downloads/1.0.026361/linux/[email protected]
- Preparing deployment. Please wait...
✖ 
✖ Deployment Failed :(
✖ Deployment Failure Reason: spawn ETXTBSY
✖ For further information, please visit the Azure Static Web Apps documentation at https://docs.microsoft.com/azure/static-web-apps/
✖ If you believe this behavior is unexpected, please raise a GitHub issue at:
  https://github.com/Azure/static-web-apps-cli/issues/new/choose

GregWoods avatar Apr 11 '24 23:04 GregWoods

I found the reason for my own problem... In Azure Portal -> Static Web App Instance -> Environments, there was a Preview Environment which was stuck in the "uploading" state from a previous deployment attempt. I deleted this and the ETXTBSY error went away.

Next, I started getting a Bad Request error, but this was caused by the Deployment Token being removed. I presume it was deleted when I removed the Preview Environment. I certainly didn't delete the Token myself.

Once I recreated the Token and updated my BitBucket pipeline variable with the new value, it all started working.

GregWoods avatar Apr 12 '24 00:04 GregWoods

https://stackoverflow.com/questions/78328458/swacli-does-not-produce-error-and-does-not-deploy

I have an issue similiar to this. the script just stops running with no error output.

image

emt2dev avatar Apr 15 '24 12:04 emt2dev