Skip to content

TypeScript apphost: withEndpoint/withHttpEndpoint lacks callback overload to modify existing endpoints #15854

@DamianEdwards

Description

@DamianEdwards

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:

  1. Calling withHttpEndpoint({ name: "http", port: 3001 }) fails with: "Endpoint with name 'http' already exists"
  2. Creating a new endpoint with a different name (e.g. app) adds a second endpoint but doesn't control the port Vite listens on
  3. 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

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-app-modelIssues pertaining to the APIs in Aspire.Hosting, e.g. DistributedApplicationarea-polyglotIssues related to polyglot apphostsaspirifridayBugs found during Aspiri-Friday

    Type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions