aspire deploy with Foundry project + compute resource (no compute environment) gives confusing 'no container registry available' error instead of actionable guidance
- Dominant language
- C#
- Stars
- 6.3k
- Forks
- 991
- Avg merge
- 2d 15h
- Merged PRs (30d)
- 196
Description
## Description
When deploying an Aspire app that has a Foundry project resource and a compute resource (e.g. a Node app or Vite app) but **no compute environment** (no `addAzureAppServiceEnvironment`, `addAzureContainerAppEnvironment`, etc.) and **no call to `asHostedAgent()`**, `aspire deploy` silently falls into a Foundry-only pipeline, builds a container image for the compute resource, then fails at `push-prereq` with:
```
Resource 'web' requires image push but no container registry is available.
Please add a container registry using 'builder.AddContainerRegistry(...)' or specify one with '.WithContainerRegistry(registryBuilder)'.
```
This error is confusing and misleading. The real issue is that there is no compute environment — the user probably forgot to add one, or intended to register the resource as a hosted agent. The error message sends them down the wrong path (adding a container registry) rather than telling them what is actually missing.
## Repro
```typescript
import { createBuilder, FoundryModels } from "./.aspire/modules/aspire.mjs";
const builder = await createBuilder();
const foundry = await builder.addFoundry("foundry");
const project = foundry.addProject("project");
const model = await foundry.addDeployment("chat", FoundryModels.OpenAI.Gpt4oMini);
const agent = await builder
.addNodeApp("agent-ha", "../api", "src/server.js")
.withHttpEndpoint({ env: "PORT" })
.withExternalHttpEndpoints()
.withReference(model);
// No asHostedAgent() call, no addAzureAppServiceEnvironment / addAzureContainerAppEnvironment
await builder
.addViteApp("web", "../web")
.withReference(agent)
.withHttpEndpoint({ env: "PORT" });
await builder.build().run();
```
```
aspire deploy
```
## Actual behavior
The pipeline builds container images for both compute resources, provisions Foundry infrastructure, then fails at `push-prereq`:
```
(push-prereq) ✗ Resource 'web' requires image push but no container registry is available.
Please add a container registry using 'builder.AddContainerRegistry(...)' or specify one with '.WithContainerRegistry(registryBuilder)'.
```
## Expected behavior
Either:
1. `validate-compute-environments` should detect that there are compute resources with no compute environment and no `asHostedAgent()` registration, and fail early with a clear message: _"Resource 'agent-ha' and 'web' are not assigned to a compute environment. Add a compute environment (e.g. `addAzureAppServiceEnvironment`, `addAzureContainerAppEnvironment`) or register them as hosted agents with `asHostedAgent()`."_
2. Or at minimum, `push-prereq` should detect the missing-compute-environment root cause and report that instead of the container registry red herring.
The current error causes the user to waste time adding a container registry when that is not the real fix.
## Environment
- Aspire CLI: 13.4.0
- Channel: staging
- AppHost language: TypeScript
- OS: macOS Darwin arm64
Contributor guide
Research direction
Reproduce the TypeScript app from the issue with `aspire deploy`, then inspect the `validate-compute-environments` and `push-prereq` pipeline stages. The fix is done when the missing compute environment is detected early and the guidance points to adding an environment or registering hosted agents instead of suggesting a container registry.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- azure, typescript
- Domain
- cli, cloud, devops
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 58/100