Skip to content

JavaScript installer ignores parent WithExplicitStart() #20186

Description

@Chicoo

Is there an existing issue for this?

  • I have searched the existing issues

Describe the bug

Issue

WithNpm(install: true) creates a separate JavaScriptInstallerResource, and the application waits for that installer to complete before starting.

The current behavior appears to ignore the WithExplicitStart() annotation on the parent JavaScript application:

  • WithNpm(install: true) creates the installer resource and causes it to auto-start.
  • WithNpm(install: false) marks the installer itself as explicit-start.
  • The parent's WithExplicitStart() annotation is not propagated to, or considered by, the generated JavaScriptInstallerResource.

As a result, an application configured with WithExplicitStart() can still cause its app-installer resource to start automatically during AppHost startup, even though the JavaScript application itself is deferred.

Expected Behavior

When the parent JavaScript application is configured with WithExplicitStart(), its associated JavaScriptInstallerResource should respect the same explicit-start semantics and not start automatically.

In other words, an explicitly started JavaScript application should not implicitly start its npm installer during AppHost startup.

This appears to conflict with the documented semantics of WithExplicitStart(), which indicate that the resource should not be started automatically.

Steps To Reproduce

Minimal reproduction

var builder = DistributedApplication.CreateBuilder(args);

var app = builder.AddJavaScriptApp("app", "../frontend")
    .WithNpm(install: true)
    .WithExplicitStart();

builder.Build().Run();

With this configuration, the expected behavior is:

  1. app is marked as ExplicitStart.
  2. app does not start automatically when the AppHost starts.
  3. The associated npm installer should likewise not start automatically.

However, the actual behavior is:

AppHost starts
    │
    ├── app              [ExplicitStart → not started]
    │
    └── app-installer    [starts automatically]
             │
             └── npm install

The app-installer is therefore started during AppHost startup even though the parent app resource has been configured with WithExplicitStart().

For comparison, removing WithExplicitStart() results in both the application and its installer starting automatically:

var app = builder.AddJavaScriptApp("app", "../frontend")
    .WithNpm(install: true);

The issue is that the generated JavaScriptInstallerResource appears to have its own startup behavior that does not take the parent's WithExplicitStart() state into account.

Exceptions (if any)

No response

Aspire doctor output


Anything else?

No response

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-app-modelIssues pertaining to the APIs in Aspire.Hosting, e.g. DistributedApplicationarea-polyglotIssues related to polyglot apphoststriage:bot-seenAspire triage bot has seen this issue

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions