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
- Add the `name` field to the domain object, e.g. `domain: { name: "api.example.com", hostedZone: "example.com" }`
- Or pass the domain as a plain string: `domain: "api.example.com"` if you don't need custom DNS/cert settings
- 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
- Prefer the plain-string domain form unless you need dns/cert/hostedZone overrides
- When switching to the object form, always copy the existing domain string into `name` first
- Type your config with the SST AppSyncArgs domain type so missing `name` is a compile-time error
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
- Need to provide a validated certificate via "cert" when DNS
- Invalid resolver ${operation}
- Cannot configure "pauseAfter" when the minimum ACU is not 0
- Cannot create more than 15 read-only replicas for the "${nam
- Need to provide a validated certificate via "cert" when DNS
AI-assisted analysis of anomalyco/sst@a0bd20f762 (2026-08-30).
Data as JSON: /api/errors/005896c185294379.
Report an issue: GitHub.