Deploy fails with no feedback, application is not deployed, stuck in "Uploading" forever
Describe the bug
Deploy fails with no feedback.
To Reproduce
swa deploy --deployment-token REDACTED
Output:
Welcome to Azure Static Web Apps CLI (1.1.7)
Deploying front-end files from folder:
C:\REDACTED\dist
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: preview
Deploying project to Azure Static Web Apps...
The CLI exits here without any other message, no error either.
Azure Portal shows "Uploading":
Expected behavior Like any feedback from the app why it fails?
Device info (if applicable):
- SWA: 1.1.7
- OS: Windows 11 23H2 22631.3296
- Node: 20.5.0
Additional context The application is very simple, consists of an html file, and a css file.
The SWA resource was just created, completely new, there was nothing deployed earlier.
Had the exact same problem and when I investigated the logs, one line caught my eye: ℹ Current directory cannot be identical to or contained within artifact folders.
So I just navigated one directory up and then ran:
swa deploy --env production -a .\frontend
and now it was successfully deployed 😃
@lstorka Thanks for the workaround! It worked!
The workaround works.
If you run the successful command but with --dry-run added you will see information still suggesting an error:
i Could not get event info. Proceeding i The content server has rejected the request with: BadRequest i Reason: Missing request content.
Also, if you navigate up two directories:
swa deploy --env production -a .\dist\frontend
it stops working again. The CLI just returns to command prompt without writing the success message "Project deployed". No warning or errors are given.
Setting the variables in the config file and having the proper folder structure is key. BTW, I'd recommend always running the cli with the --verbose silly switch.
I just wrapped up a blog post that could help shed some light on this. Using Azure Functions with Astro and Entra ID Authentication