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)

Đang mở
#910 1 bình luận 0 reaction 1 người được giao Được @Timothyw0 nhận Xem trên GitHub
Ngôn ngữ chính
TypeScript
Star
668
Fork
156
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Mô tả

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`

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.