Azure / Azure/static-web-apps-cli
`swa-cli.config.json` works differently between `swa start`/`swa build` and `swa deploy` in .NET 9 (Blazor WASM + Azure Functions app)
- Dominant language
- TypeScript
- Stars
- 668
- Forks
- 156
- PR merge metrics
- No merged PRs in 30d
Description
Before filing this issue, please ensure you're using the latest CLI by running `swa --version` and comparing to the latest version on [npm](https://www.npmjs.com/package/@azure/static-web-apps-cli).
**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
- [x] 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**
A clear and concise description of what the bug is.
Here's my `swa-cli.config.json`:
```json
{
"$schema": "https://aka.ms/azure/static-web-apps-cli/schema",
"configurations": {
"azure-easyauth-sample": {
"appLocation": "src/EasyAuth.SwaApp",
"apiLocation": "src/EasyAuth.FunctionApp",
"outputLocation": "bin/wwwroot",
"apiLanguage": "dotnetisolated",
"apiVersion": "9.0",
"appBuildCommand": "dotnet publish -c Release -o bin",
"apiBuildCommand": "dotnet publish -c Release",
"run": "dotnet watch run",
"appDevserverUrl": "http://localhost:8080"
}
}
}
```
This works perfectly fine with `swa start` and `swa build`. But, when it comes with the command `swa deploy`, the `apiLocation` part keeps complaining. Therefore, I have to use the `swa deploy` command like this:
```bash
swa deploy --api-location src/EasyAuth.FunctionApp/bin/Release/net9.0 ...`
```
**To Reproduce**
Steps to reproduce the behavior:
1. Clone [https://github.com/devkimchi/azure-easyauth-sample](https://github.com/devkimchi/azure-easyauth-sample)
1. Provision Azure Static Web Apps (ASWA) instance.
1. Get the deployment token from the ASWA instance.
1. Type in command `swa build`
1. Type in command `swa deploy --deployment-token {{deployment_token}}`
1. See error
If I run the following command, it deploys successfully:
1. Type in command `swa deploy --api-location src/EasyAuth.FunctionApp/bin/Release/net9.0 --deployment-token {{deployment_token}}`
1. See no error
**Expected behavior**
A clear and concise description of what you expected to happen.
It should be deployed without having to add the `--api-location` parameter to alter the location.
**Desktop (please complete the following information):**
- OS: `Windows 11 Enterprise`
- Version: `24H2`
**Additional context**
Add any other context about the problem here.
- swa version: `2.0.2`
- func version: `4.0.6610`
Contributor guide
Assessment
This issue has not been assessed yet.