{"record":{"id":"89ea08d4086c3b68","repo":"anomalyco/sst","slug":"cannot-access-the-aws-cloud-map-service-name-for-t","errorCode":null,"errorMessage":"Cannot access the AWS Cloud Map service name for the \"${this._name}\" Service. Cloud Map is not configured for the cluster.","messagePattern":"Cannot access the AWS Cloud Map service name for the \"(.+?)\" Service\\. Cloud Map is not configured for the cluster\\.","errorType":"exception","errorClass":"VisibleError","httpStatus":null,"severity":"error","filePath":"platform/src/components/aws/service.ts","lineNumber":2860,"sourceCode":"    const errorMessage =\n      \"Cannot access the URL because no public ports are exposed.\";\n    if (this.dev) {\n      if (!this.devUrl) throw new VisibleError(errorMessage);\n      return this.devUrl;\n    }\n\n    if (!this._url) throw new VisibleError(errorMessage);\n    return this._url;\n  }\n\n  /**\n   * The name of the Cloud Map service. This is useful for service discovery.\n   */\n  public get service() {\n    return all([this.cloudmapNamespace, this.cloudmapService]).apply(\n      ([namespace, service]) => {\n        if (!namespace)\n          throw new VisibleError(\n            `Cannot access the AWS Cloud Map service name for the \"${this._name}\" Service. Cloud Map is not configured for the cluster.`,\n          );\n\n        return this.dev\n          ? interpolate`dev.${namespace}`\n          : interpolate`${service!.name}.${namespace}`;\n      },\n    );\n  }\n\n  /**\n   * The underlying [resources](/docs/components/#nodes) this component creates.\n   */\n  public get nodes() {\n    const self = this;\n    return {\n      /**\n       * The Amazon ECS Service.","sourceCodeStart":2842,"sourceCodeEnd":2878,"githubUrl":"https://github.com/anomalyco/sst/blob/a0bd20f762883e72a35caccb4896c42ce5b3f707/platform/src/components/aws/service.ts#L2842-L2878","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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."],"exampleFix":"// before\nconst cluster = new sst.aws.Cluster(\"Cluster\");\nconst svc = new sst.aws.Service(\"Svc\", { cluster });\nconst name = svc.service; // throws\n// after\nconst cluster = new sst.aws.Cluster(\"Cluster\", {\n  cloudmap: true\n});\nconst svc = new sst.aws.Service(\"Svc\", { cluster });\nconst name = svc.service; // \"svc.cluster.local\" style name","handlingStrategy":"validation","validationCode":"if (!clusterArgs.cloudmap) {\n  throw new Error(\"Cluster must have cloudmap configured before Service.service discovery names are available\");\n}","typeGuard":"function cloudmapConfigured(cluster: { cloudmap?: { namespace?: string } | boolean }): boolean {\n  return cluster.cloudmap === true || (typeof cluster.cloudmap === \"object\" && !!cluster.cloudmap?.namespace);\n}","tryCatchPattern":"let discoveryName: string;\ntry {\n  discoveryName = svc.service;\n} catch (e) {\n  if (e instanceof VisibleError && e.message.includes(\"Cloud Map is not configured\")) {\n    throw new Error(`Enable cloudmap on the cluster used by \"${svcName}\" to use service discovery`);\n  }\n  throw e;\n}","preventionTips":["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."],"tags":["aws","ecs","cloudmap","service-discovery","configuration"],"backgroundTag":"cloudmap-not-configured","analyzedSha":"a0bd20f762883e72a35caccb4896c42ce5b3f707","analyzedAt":"2026-08-30T11:26:00.383Z","schemaVersion":2},"datasetVersion":"2026-08-30T13:17:10.514Z"}