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

Deployment Failure Reason: spawn EBUSY

Open tobiasdiez opened this issue 1 year ago • 18 comments

Before filing this issue, please ensure you're using the latest CLI by running swa --version and comparing to the latest version on npm.

Are you accessing the CLI from the default port :4280 ?

  • [ ] No, I am using a different port number (--port) and accessing the CLI from that port
  • [ ] Yes, I am accessing the CLI from port :4280

Make sure you are accessing the URL printed in the console when running swa start!

ℹ️ NOTE: Make sure to enable debug logs when running any swa commands using --verbose=silly

Describe the bug Sometimes the deployment via swa deploy fails on CI.

##[debug]Evaluating: secrets.AZURE_STATIC_WEB_APPS_API_TOKEN_MANGO_PEBBLE_0224C3803
##[debug]Evaluating Index:
##[debug]..Evaluating secrets:
##[debug]..=> Object
##[debug]..Evaluating String:
##[debug]..=> 'AZURE_STATIC_WEB_APPS_API_TOKEN_MANGO_PEBBLE_0224C3803'
##[debug]=> '***'
##[debug]Result: '***'
##[debug]Evaluating condition for step: 'Deploy Web App'
##[debug]Evaluating: success()
##[debug]Evaluating success:
##[debug]=> true
##[debug]Result: true
##[debug]Starting: Deploy Web App
##[debug]Loading inputs
##[debug]Evaluating: format('# Delete old deployment (otherwise we get a spawn EBUSY error when running the workflow again)
##[debug]az staticwebapp environment delete --name jabref-online --environment-name {0} --yes || true
##[debug]
##[debug]yarn swa deploy .output\public --env {1}
##[debug]', matrix.deployment_environment, matrix.deployment_environment)
##[debug]Evaluating format:
##[debug]..Evaluating String:
##[debug]..=> '# Delete old deployment (otherwise we get a spawn EBUSY error when running the workflow again)
##[debug]az staticwebapp environment delete --name jabref-online --environment-name {0} --yes || true
##[debug]
##[debug]yarn swa deploy .output\public --env {1}
##[debug]'
##[debug]..Evaluating Index:
##[debug]....Evaluating matrix:
##[debug]....=> Object
##[debug]....Evaluating String:
##[debug]....=> 'deployment_environment'
##[debug]..=> 'default'
##[debug]..Evaluating Index:
##[debug]....Evaluating matrix:
##[debug]....=> Object
##[debug]....Evaluating String:
##[debug]....=> 'deployment_environment'
##[debug]..=> 'default'
##[debug]=> '# Delete old deployment (otherwise we get a spawn EBUSY error when running the workflow again)
##[debug]az staticwebapp environment delete --name jabref-online --environment-name default --yes || true
##[debug]
##[debug]yarn swa deploy .output\public --env default
##[debug]'
##[debug]Result: '# Delete old deployment (otherwise we get a spawn EBUSY error when running the workflow again)
##[debug]az staticwebapp environment delete --name jabref-online --environment-name default --yes || true
##[debug]
##[debug]yarn swa deploy .output\public --env default
##[debug]'
##[debug]Loading env
Run # Delete old deployment (otherwise we get a spawn EBUSY error when running the workflow again)
##[debug]C:\Program Files\PowerShell\7\pwsh.EXE -command ". 'D:\a\_temp\962b834b-afe0-484e-8e84-9c35b7e02f5a.ps1'"
ERROR: Operation returned an invalid status 'Bad Request'

Welcome to Azure Static Web Apps CLI (1.1.2)

Deploying front-end files from folder:
  D:\a\JabRefOnline\JabRefOnline\.output\public

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: default


Found configuration file:
  D:\a\JabRefOnline\JabRefOnline\staticwebapp.config.json

Deploying project to Azure Static Web Apps...
Could not find StaticSitesClient local binary
- Downloading https://swalocaldeploy.azureedge.net/downloads/1.0.023421/windows/[email protected]
[swa] ✔ Downloading https://swalocaldeploy.azureedge.net/downloads/1.0.023421/windows/[email protected]
- Preparing deployment. Please wait...

✖ 
✖ Deployment Failed :(
✖ Deployment Failure Reason: spawn EBUSY
✖ 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
Error: Process completed with exit code 1.
##[debug]Finishing: Deploy Web App

e.g. https://github.com/JabRef/JabRefOnline/actions/runs/5480147768/jobs/9989069413

To Reproduce Steps to reproduce the behavior:

  1. Run swa deploy in CI.

Expected behavior Deployment is successful.

Screenshots If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

  • OS: Github CI, Windows Server 2022
  • Version [e.g. 22]

tobiasdiez avatar Jul 07 '23 07:07 tobiasdiez

+1. We also noticed this problem, and re-run the job can help. We will investigate it.

cjk7989 avatar Jul 10 '23 11:07 cjk7989

+1. also run into this issue pretty often. the only clue I have found, is that for some reason the error seems less prevalent when I tell everyone to close the app. Given that our swa runs on a windows license makes me suspect that it could be windows file locking. But I would like to say this is mostly just a guess

chris-kruining avatar Jul 13 '23 05:07 chris-kruining

+1. Observed this issue in our deployment pipeline today (azure devops)

quality-leftovers avatar Aug 03 '23 07:08 quality-leftovers

Still happens a lot. Any update?

quality-leftovers avatar Sep 04 '23 06:09 quality-leftovers

So anyone got a solution / workaround aside from CallAzureThingyInLoopBecauseOfRandomFailures()?

quality-leftovers avatar Sep 07 '23 12:09 quality-leftovers

no solution yet

chris-kruining avatar Sep 19 '23 06:09 chris-kruining

FWIW, we are seeing this issue more often than not when attempting to deploy.

If it helps, we are using a "swa deploy" AZ CLI command on a windows-latest Microsoft-hosted agent. The agents appear to be running AZ CLI version 2.52.0 and SWA CLI version 1.1.4.

TonyLunt avatar Oct 03 '23 20:10 TonyLunt

Same here - seeing this periodically on Windows Azure build agent

alexhowgego avatar Nov 21 '23 16:11 alexhowgego

for us switching to linux agents seems to have "fixed" the issue. When you dig down into the EBUSY error you get some answers that I think hinted towards file locking. That combined with the linux agent not (yet) haiving this issue seems to confirm that for me

chris-kruining avatar Nov 26 '23 13:11 chris-kruining