Files
h-school/docs/bugs/02-client-endpoint-proxy.md

41 lines
2.0 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# Баг 2. AppHost падает на пине Vite 5173
## Симптом
`run-aspire.cmd` поднимает Tailscale Serve, затем AppHost сразу выходит с кодом `-532462766`. Aspire dashboard и Vite не стартуют. В логе:
```
The endpoint 'http' for resource 'client' requested a proxy (IsProxied is true).
Non-container resources cannot be proxied when both TargetPort and Port are specified
with the same value.
```
Ожидали клиент на `http://localhost:5173` (и тот же порт за Serve), как после пина для Tailscale.
## Причина
`AddViteApp` зовёт `WithHttpEndpoint(port: 5173, targetPort: 5173)`. У executable `IsProxied` по умолчанию `true`. DCP не может повесить прокси на тот же порт, на котором слушает Vite. Aspire 13.4 это ловит при старте. Headless-тесты клиент не поднимают, поэтому сюита хоста этого не видит.
## Путь
`isProxied: false` на том же пине: Vite сам слушает 5173, прокси Aspire нет, `tailscale serve --bg 5173` по-прежнему бьёт в клиент.
Не снимать пин — Serve тогда не знает порт. Не оставлять прокси и задавать только `port`у Vite `strictPort: true` на 5173, конфликт с прокси.
## Задачи
- [x] Эндпоинт `http` у `client`: порт 5173, без прокси Aspire
- [x] Тест модели AppHost без `AppHostFixture` и без Node
## Тест, без которого не закрыт
`HSchool.AppHost.Tests`, без фикстуры хоста: ресурс `client` имеет HTTP-эндпоинт на 5173 с `IsProxied == false`.
```bash
dotnet test tests/HSchool.AppHost.Tests --filter FullyQualifiedName~ClientEndpoint
```
## Стоп
Протокол, сейв, Vite `allowedHosts` / HMR, `run-aspire.cmd` не трогать.