microsoft / microsoft/aspire

addDevTunnel polyglot binding missing region option (Node.js app host)

Open Beginner friendly
#19,495 1 comment 0 reactions 0 assignees View on GitHub
area-integrations
Dominant language
C#
Stars
6.3k
Forks
991
Avg merge
2d 15h
Merged PRs (30d)
196

Description

### Is there an existing issue for this?

- [x] I have searched the existing issues

### Describe the bug

DevTunnelOptions.Region was added in [#14112](https://github.com/microsoft/aspire/pull/14112/changes) but AddDevTunnelForPolyglot was not updated, so the region option is unavailable in Node.js app hosts. I guess it was added now on 13.5 which causes the contracts to be different now between .NET and Typescript (unable to use used in Typescript apphost). We were eagerly awaiting this option to overcome this related issue https://github.com/microsoft/aspire/issues/18790 which is still opened.

### Expected Behavior

addDevTunnel in a Typescript app host should accept a region option, matching the C# API:

```
builder.addDevTunnel('tunnel', {
tunnelId: 'my-tunnel',
allowAnonymous: true,
region: 'NorthEurope'
});
```

### Steps To Reproduce

**Actual behavior**
AddDevTunnelOptions in the generated aspire.mts has no region field:

```
export interface AddDevTunnelOptions {
tunnelId?: string;
allowAnonymous?: boolean;
description?: string;
labels?: string[];
// region is missing
}
```

### Exceptions (if any)

_No response_

### Aspire doctor output

_No response_

### Anything else?

**Likely Root cause**
AddDevTunnelForPolyglot in src/Aspire.Hosting.DevTunnels/DevTunnelResourceBuilderExtensions.cs was not updated in #14112. The Region property is set on DevTunnelOptions in C# but is never plumbed through the polyglot RPC entry point, so the TypeScript code generator (AtsTypeScriptCodeGenerator) never sees it and does not emit it.

**Possible Fix**
In `src/Aspire.Hosting.DevTunnels/DevTunnelResourceBuilderExtensions.cs`, add region to AddDevTunnelForPolyglot:

```
internal static IResourceBuilder AddDevTunnelForPolyglot(
this IDistributedApplicationBuilder builder,
[ResourceName] string name,
string? tunnelId = null,
bool allowAnonymous = false,
string? description = null,
string[]? labels = null,
DevTunnelRegion? region = null) // add this
=> AddDevTunnel(builder, name, tunnelId, new DevTunnelOptions
{
AllowAnonymous = allowAnonymous,
Description = description,
Labels = labels is null ? null : [.. labels],
Region = region // and this
});
```

Contributor guide

Open the contributing guide

Research direction

Start in src/Aspire.Hosting.DevTunnels/DevTunnelResourceBuilderExtensions.cs at AddDevTunnelForPolyglot, then compare its parameters with DevTunnelOptions.Region. Check how the generated aspire.mts interface is produced and verify that a TypeScript app host can accept the region option when the binding is updated.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp, node.js, typescript
Domain
api, developer-experience, tooling
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Active
Clarity
Clearly specified
Newbie friendliness
88/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.