microsoft / microsoft/aspire

TS AppHost: unawaited fluent chain produces misleading 'Flushing N pending promise(s)' warning instead of actionable diagnostic

Open
#17,677 1 comment 0 reactions 0 assignees View on GitHub
area-polyglot triage:bot-seen
Dominant language
C#
Stars
6.3k
Forks
991
Avg merge
2d 15h
Merged PRs (30d)
196

Description

## Summary

In a TypeScript AppHost (\pphost.mts\), if a developer forgets to \wait\ a fluent resource call, the AppHost starts anyway but emits a vague warning:

\\\
Flushing 5 pending promise(s)...
\\\

The resources configured in the unawaited chain (e.g. process commands, environment variables, lifetime settings) are silently dropped or misconfigured. The AppHost appears healthy but behaves incorrectly.

## Repro

\\\ ypescript
// apphost.mts
const builder = await createBuilder();

// Missing await — compiles fine, runtime silently drops the command registration
const api = builder.addJavaScriptApp('api', './services/api', { command: 'start' });
api.withProcessCommandFactory('node-version', 'Node Version', async () => ({
executable: 'node',
args: ['--version'],
}));

await builder.build();
\\\

**Expected:** The command \
ode-version\ is registered and visible via \spire resource api --help\.
**Actual:** The command is silently not registered. The warning appears at the end of startup but does not identify which resource or chain was unawaited.

## What the warning looks like

\\\
[AppHost] Flushing 5 pending promise(s)...
\\\

No file/line reference, no resource name, no indication of what was lost.

## Expected behavior

One or more of:
1. **Point to the resource** — e.g. 'Flushing pending promise for resource api — did you forget to await?'
2. **Warn at the call site** — a lint rule or runtime stack-capture that identifies *which* fluent call was not awaited
3. **Fail loudly** — treat unawaited chains as a startup error rather than a warning, since the resulting state is silently broken

## Context

Discovered during Aspire 13.4 TS polyglot validation. The warning is easy to overlook in startup log noise, and the symptom (missing commands, dropped env vars) can be very hard to connect back to the missing \wait\ without knowing what to look for.

## Environment

- Aspire version: 13.4
- AppHost type: TypeScript polyglot (\pphost.mts\)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.