anomalyco/sst · error · VisibleError

You must provide both "vpc.cloudmapNamespaceId" and "vpc.clo

Error message

You must provide both "vpc.cloudmapNamespaceId" and "vpc.cloudmapNamespaceName" for the "${name}" Cluster component.

What it means

Cloudmap namespace registration needs both the namespace ID and its name: the ID locates the namespace, the name is used for DNS record prefixes. Supplying exactly one is treated as a partial/invalid config, so SST throws.

Source

Thrown at platform/src/components/aws/cluster.ts:293

        return args.vpc;
      }

      // "vpc" is object
      return output(args.vpc).apply((vpc) => {
        if (vpc.containerSubnets && vpc.serviceSubnets)
          throw new VisibleError(
            `You cannot provide both "vpc.containerSubnets" and "vpc.serviceSubnets" in the "${name}" Cluster component. The "serviceSubnets" property has been deprecated. Use "containerSubnets" instead.`,
          );
        if (!vpc.containerSubnets && !vpc.serviceSubnets)
          throw new VisibleError(
            `Missing "vpc.containerSubnets" for the "${name}" Cluster component.`,
          );

        if (
          (vpc.cloudmapNamespaceId && !vpc.cloudmapNamespaceName) ||
          (!vpc.cloudmapNamespaceId && vpc.cloudmapNamespaceName)
        )
          throw new VisibleError(
            `You must provide both "vpc.cloudmapNamespaceId" and "vpc.cloudmapNamespaceName" for the "${name}" Cluster component.`,
          );

        return {
          ...vpc,
          containerSubnets: (vpc.containerSubnets ?? vpc.serviceSubnets)!,
          serviceSubnets: undefined,
        };
      });
    }

    function createCluster() {
      return new ecs.Cluster(
        ...transform(
          args.transform?.cluster,
          `${name}Cluster`,
          {
            tags: {

View on GitHub (pinned to a0bd20f762)

Solutions

  1. Provide both cloudmapNamespaceId and cloudmapNamespaceName in the vpc object.
  2. If the cluster was created via sst.aws.Vpc, prefer passing the Vpc instance so both values are wired automatically.
  3. Verify the namespace exists in AWS Cloud Map in the same region as the cluster.

Example fix

// before
vpc: { containerSubnets: [...], cloudmapNamespaceId: 'ns-abc' }
// after
vpc: { containerSubnets: [...], cloudmapNamespaceId: 'ns-abc', cloudmapNamespaceName: 'myapp.local' }
Defensive patterns

Strategy: validation

Validate before calling

function requireCloudmapPair(vpc) {
  const hasId = !!vpc?.cloudmapNamespaceId, hasName = !!vpc?.cloudmapNamespaceName;
  if (hasId !== hasName)
    throw new Error('Provide both cloudmapNamespaceId and cloudmapNamespaceName');
}
requireCloudmapPair(vpcConfig);

Prevention

When it happens

Trigger: Cluster vpc object with cloudmapNamespaceId set but cloudmapNamespaceName missing, or vice versa — checked in normalizeVpc.

Common situations: Reading only the ID from the AWS console and hardcoding it while omitting the name; referencing a Vpc component's outputs but only wiring one of the two values.

Related errors


AI-assisted analysis of anomalyco/sst@a0bd20f762 (2026-08-30). Data as JSON: /api/errors/56ecca5f84221472. Report an issue: GitHub.