anomalyco/sst · error · VisibleError
Cannot access the AWS Cloud Map service name for the "${this
Error message
Cannot access the AWS Cloud Map service name for the "${this._name}" Service. Cloud Map is not configured for the cluster. What it means
The `service` getter returns the Cloud Map service-discovery name (`<service>.<namespace>`), which is only available when the underlying cluster has Cloud Map configured. If the Service's cluster has no Cloud Map namespace (`cloudmapNamespace` is undefined), the getter throws this VisibleError because there is no discovery name to return.
Source
Thrown at platform/src/components/aws/service.ts:2860
const errorMessage =
"Cannot access the URL because no public ports are exposed.";
if (this.dev) {
if (!this.devUrl) throw new VisibleError(errorMessage);
return this.devUrl;
}
if (!this._url) throw new VisibleError(errorMessage);
return this._url;
}
/**
* The name of the Cloud Map service. This is useful for service discovery.
*/
public get service() {
return all([this.cloudmapNamespace, this.cloudmapService]).apply(
([namespace, service]) => {
if (!namespace)
throw new VisibleError(
`Cannot access the AWS Cloud Map service name for the "${this._name}" Service. Cloud Map is not configured for the cluster.`,
);
return this.dev
? interpolate`dev.${namespace}`
: interpolate`${service!.name}.${namespace}`;
},
);
}
/**
* The underlying [resources](/docs/components/#nodes) this component creates.
*/
public get nodes() {
const self = this;
return {
/**
* The Amazon ECS Service.View on GitHub (pinned to a0bd20f762)
Solutions
- Configure Cloud Map on the cluster the Service runs in (set the cluster's cloudmap/namespace option) and redeploy.
- Use the default managed cluster, which sets up Cloud Map automatically.
- If discovery isn't needed, stop accessing `.service` and reference the ECS service or a URL/link directly.
Example fix
// before
const cluster = new sst.aws.Cluster("Cluster");
const svc = new sst.aws.Service("Svc", { cluster });
const name = svc.service; // throws
// after
const cluster = new sst.aws.Cluster("Cluster", {
cloudmap: true
});
const svc = new sst.aws.Service("Svc", { cluster });
const name = svc.service; // "svc.cluster.local" style name Defensive patterns
Strategy: validation
Validate before calling
if (!clusterArgs.cloudmap) {
throw new Error("Cluster must have cloudmap configured before Service.service discovery names are available");
} Type guard
function cloudmapConfigured(cluster: { cloudmap?: { namespace?: string } | boolean }): boolean {
return cluster.cloudmap === true || (typeof cluster.cloudmap === "object" && !!cluster.cloudmap?.namespace);
} Try / catch
let discoveryName: string;
try {
discoveryName = svc.service;
} catch (e) {
if (e instanceof VisibleError && e.message.includes("Cloud Map is not configured")) {
throw new Error(`Enable cloudmap on the cluster used by "${svcName}" to use service discovery`);
}
throw e;
} Prevention
- Always enable `cloudmap: true` on custom clusters that host services needing discovery.
- Prefer the default managed cluster when you rely on `.service`.
- Standardize cluster construction in a shared module so cloudmap is never accidentally omitted.
- Use service links instead of Cloud Map names when discovery is not required.
When it happens
Trigger: Accessing `myService.service` on a Service whose cluster (e.g. a Cluster component or the default cluster) was created without a Cloud Map namespace — typically when `cloudmap` was not configured on the cluster.
Common situations: Using a custom `Cluster` without enabling Cloud Map and then trying service discovery by name; switching from the default cluster (which configures Cloud Map) to a bare one; sharing cluster config across stacks where one omits cloudmap.
Related errors
- You must provide both "vpc.cloudmapNamespaceId" and "vpc.clo
- Cannot access `nodes.loadBalancer` when no public ports are
- You must provide the ports to expose via "loadBalancer.rules
- You must provide a container name in "loadBalancer.rules" wh
- Target group "${tgtId}" not found. Ensure the forward port m
AI-assisted analysis of anomalyco/sst@a0bd20f762 (2026-08-30).
Data as JSON: /api/errors/89ea08d4086c3b68.
Report an issue: GitHub.