`swa-cli.config.json` works differently between `swa start`/`swa build` and `swa deploy` in .NET 9 (Blazor WASM + Azure Functions app)
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 - [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:
{
"$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:
swa deploy --api-location src/EasyAuth.FunctionApp/bin/Release/net9.0 ...`
To Reproduce Steps to reproduce the behavior:
- Clone https://github.com/devkimchi/azure-easyauth-sample
- Provision Azure Static Web Apps (ASWA) instance.
- Get the deployment token from the ASWA instance.
- Type in command
swa build - Type in command
swa deploy --deployment-token {{deployment_token}} - See error
If I run the following command, it deploys successfully:
- Type in command
swa deploy --api-location src/EasyAuth.FunctionApp/bin/Release/net9.0 --deployment-token {{deployment_token}} - 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
I have the same issue with the CLI on version 2.0.6 with a .NET 8 azure function. For swa start/build it expects the apiLocation to be the root folder of the function app. For swa deploy it expects the bin folder to be the apiLocation