anomalyco/sst · error · Error

Missing "name" for domain.

Error message

Missing "name" for domain.

What it means

The SST AppSync component's `domain` argument accepts either a plain string (the domain name) or an object with `name`, `dns`, `cert` and other fields. During normalization, `normalizeDomain` unwraps the Output-wrapped domain and, if it is an object, requires a `name` property. The library throws because it cannot know which domain name to attach the AppSync domain name and DNS records to.

Source

Thrown at platform/src/components/aws/app-sync.ts:528

    const certificateArn = createSsl();
    const domainName = createDomainName();
    createDnsRecords();

    this.constructorName = name;
    this.constructorOpts = opts;
    this.api = api;
    this.domainName = domainName;

    this.registerOutputs({ _hint: this.url });

    function normalizeDomain() {
      if (!args.domain) return;

      // validate
      output(args.domain).apply((domain) => {
        if (typeof domain === "string") return;

        if (!domain.name) throw new Error(`Missing "name" for domain.`);
        if (domain.dns === false && !domain.cert)
          throw new Error(
            `Need to provide a validated certificate via "cert" when DNS is disabled`,
          );
      });

      // normalize
      return output(args.domain).apply((domain) => {
        const norm = typeof domain === "string" ? { name: domain } : domain;

        return {
          name: norm.name,
          dns: norm.dns === false ? undefined : norm.dns ?? awsDns(),
          cert: norm.cert,
        };
      });
    }

View on GitHub (pinned to a0bd20f762)

Solutions

  1. Add the `name` field to the domain object, e.g. `domain: { name: "api.example.com", hostedZone: "example.com" }`
  2. Or pass the domain as a plain string: `domain: "api.example.com"` if you don't need custom DNS/cert settings
  3. Check the AppSyncArgs type definition in platform/src/components/aws/app-sync.ts for the exact DomainArgs shape

Example fix

// before
new sst.aws.AppSync("Api", {
  domain: { hostedZone: "example.com", dns: true }
});
// after
new sst.aws.AppSync("Api", {
  domain: { name: "api.example.com", hostedZone: "example.com", dns: true }
});
Defensive patterns

Strategy: validation

Validate before calling

function validateAppSyncDomain(domain) {
  if (typeof domain === "string") return;
  if (domain && typeof domain === "object" && !domain.name)
    throw new Error('AppSync domain object requires a "name" field');
}
validateAppSyncDomain(args.domain);

Type guard

function isDomainArgs(d) {
  return typeof d === "object" && d !== null && typeof d.name === "string" && d.name.length > 0;
}

Try / catch

null

Prevention

When it happens

Trigger: Passing `domain: { dns: true, hostedZone: "..." }` (or any object form) to `new sst.aws.AppSync(...)` without a `name` field, instead of a plain string like `domain: "api.example.com"`.

Common situations: Copy-pasting a domain config from another component (ApiGateway, etc.) where the property is named differently (e.g. `domainName` or `path`), or refactoring from string form to object form to add `hostedZone`/`cert` and accidentally dropping `name`.

Related errors


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