microsoft / microsoft/aspire

Error Deploying .NET Aspire ViteApp Using azd in Azure DevOps Pipeline

Open
#11,605 3 comments 0 reactions 0 assignees View on GitHub
area-deployment
Dominant language
C#
Stars
6.3k
Forks
991
Avg merge
2d 15h
Merged PRs (30d)
196

Description

I am using .net Aspire to orchestrate an .net 9 Web Api and a standalone react app (Vite). Running the application locally works like a charm.
Now i am trying to publish both to azure container apps. Publishing only the api (using azd with bicep files) also works fine but i am struggeling with publishing the react app. Once i add the vite app, generating the bicep files fails (`azd infra gen`) , and i am not able to deploy to azure anymore. What am i missing here? Unfortunatley there is not much documentation about how to deploy and NPM / Vite App to azure.

In my AppHost Program.cs i am using this code to setup the ViteApp:

```
builder.AddViteApp(name: "manager", workingDirectory: "../../frontends", packageManager: "yarn")
.WaitFor(api)
.WithAzureUserAssignedIdentity(appIdentity)
.WithYarnPackageInstallation()
.PublishAsAzureContainerApp((config, app) => {
app.Template.Scale.MinReplicas = 0;
app.Template.Scale.MaxReplicas = 1;
app.Template.Scale.CooldownPeriod = 28800; // 8 hours
});
```

Contributor guide

Open the contributing guide

Research direction

Start in the AppHost Program.cs entry point and reproduce azd infra gen with the Vite app registration shown in the issue. Compare generation with the API-only setup and capture the missing error details; the work is done when infrastructure generation and deployment of both resources succeed.

Written by the indexing model from the issue text.

Assessment

Tech stack
azure, csharp, react
Domain
build-system, cloud, devops, frontend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.