Summary
The C# Aspire hosting API provides a callback overload for WithEndpoint that allows modifying an existing endpoint by name (e.g. to change the port of an auto-created endpoint). The TypeScript apphost SDK does not expose this overload, making it impossible to customize endpoints that are automatically created by resource types like AddViteApp.
Problem
AddViteApp automatically creates an http endpoint. There is no way to modify its port after creation because:
- Calling
withHttpEndpoint({ name: "http", port: 3001 }) fails with: "Endpoint with name 'http' already exists"
- Creating a new endpoint with a different name (e.g.
app) adds a second endpoint but doesn't control the port Vite listens on
- There is no callback overload like the C# API has:
WithEndpoint("http", endpoint => { endpoint.Port = 3001; })
Expected Behavior
The TypeScript SDK should support modifying existing endpoints, either via:
// Option A: Callback overload (matching C# API)
.withEndpoint("http", (endpoint) => {
endpoint.port = 3001;
endpoint.isProxied = false;
})
// Option B: Allow withHttpEndpoint to update existing endpoints by name
.withHttpEndpoint({ name: "http", port: 3001, isProxied: false })
Workaround
Currently the only workaround is to drop down to addExecutable and manually configure the command, args, and endpoints, losing the benefits of addViteApp (auto package install, Vite config detection, etc.).
Environment
- Aspire SDK: 13.2.1
- TypeScript apphost
Summary
The C# Aspire hosting API provides a callback overload for
WithEndpointthat allows modifying an existing endpoint by name (e.g. to change the port of an auto-created endpoint). The TypeScript apphost SDK does not expose this overload, making it impossible to customize endpoints that are automatically created by resource types likeAddViteApp.Problem
AddViteAppautomatically creates anhttpendpoint. There is no way to modify its port after creation because:withHttpEndpoint({ name: "http", port: 3001 })fails with: "Endpoint with name 'http' already exists"app) adds a second endpoint but doesn't control the port Vite listens onWithEndpoint("http", endpoint => { endpoint.Port = 3001; })Expected Behavior
The TypeScript SDK should support modifying existing endpoints, either via:
Workaround
Currently the only workaround is to drop down to
addExecutableand manually configure the command, args, and endpoints, losing the benefits ofaddViteApp(auto package install, Vite config detection, etc.).Environment