anomalyco/sst · error · VisibleError

Invalid AWS region: "${region}". Please specify a valid AWS

Error message

Invalid AWS region: "${region}". Please specify a valid AWS region.

What it means

After checking the region is in SST's supported allow-list, `normalizeRegions` also verifies each region is a real AWS region by membership in the `Region` enum. If the string is not a valid AWS region at all (bad format, typo, non-AWS region id), this error is thrown naming the value.

Source

Thrown at platform/src/components/aws/ssr-site.ts:1246

        return regions.map((region) => {
          if (
            [
              "ap-south-2",
              "ap-southeast-4",
              "ap-southeast-5",
              "ca-west-1",
              "eu-south-2",
              "eu-central-2",
              "il-central-1",
              "me-central-1",
            ].includes(region)
          )
            throw new VisibleError(
              `Region ${region} is not supported by this component. Please select a different AWS region.`,
            );

          if (!Object.values(Region).includes(region as Region))
            throw new VisibleError(
              `Invalid AWS region: "${region}". Please specify a valid AWS region.`,
            );
          return region as Region;
        });
      });
    }

    function normalizeRoute() {
      const route = normalizeRouteArgs(args.router, args.route);

      if (route) {
        if (args.domain)
          throw new VisibleError(
            `Cannot provide both "domain" and "route". Use the "domain" prop on the "Router" component when serving your site through a Router.`,
          );

        if (args.edge)
          throw new VisibleError(

View on GitHub (pinned to a0bd20f762)

Solutions

  1. Correct the region string to a valid AWS region identifier (e.g. "us-east-1")
  2. Use an IDE autocomplete on the `Region` enum to pick a valid value
  3. Validate the list before passing it into the component

Example fix

// before
new sst.aws.NextjsSite("Web", { path: "src", regions: ["us-east1"] });
// after
new sst.aws.NextjsSite("Web", { path: "src", regions: ["us-east-1"] });
Defensive patterns

Strategy: validation

Validate before calling

const AWS_REGION_RE = /^(us|eu|ap|sa|ca|me|af|il|cn)-[a-z]+-\d$/;
for (const r of regions) if (!AWS_REGION_RE.test(r)) throw new Error(`Invalid AWS region: ${r}`);

Type guard

function isValidAwsRegion(r: string): boolean {
  return /^(us|eu|ap|sa|ca|me|af|il|cn)-[a-z]+-\d$/.test(r);
}

Try / catch

try {
  new sst.aws.NextjsSite("Web", { path: "src", regions });
} catch (e) {
  if (String(e).includes("Invalid AWS region")) console.error("Fix the region identifier format");
  throw e;
}

Prevention

When it happens

Trigger: Passing a malformed region string in `regions`, e.g. `regions: ["us-east1"]` (missing hyphen), `regions: ["east-us-1"]`, or a GCP/Azure region id.

Common situations: Hand-typed region names with typos; generating region lists programmatically and concatenating wrong; confusing availability-zone names (us-east-1a) with region names.

Related errors


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