{"record":{"id":"fc51d0c369b63d25","repo":"anomalyco/sst","slug":"record-name-recordname-is-not-a-subdomain-of","errorCode":null,"errorMessage":"Record name \"${recordName}\" is not a subdomain of \"${domain}\".","messagePattern":"Record name \"(.+?)\" is not a subdomain of \"(.+?)\"\\.","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"platform/src/components/vercel/dns.ts","lineNumber":145,"sourceCode":"      ),\n    ];\n  }\n\n  function createRecord(\n    namePrefix: string,\n    record: Record,\n    opts: ComponentResourceOptions,\n  ) {\n    return all([args.domain, record]).apply(([domain, record]) => {\n      const nameSuffix = logicalName(record.name);\n      const recordName = validateRecordName();\n      const dnsRecord = createRecord();\n      return dnsRecord;\n\n      function validateRecordName() {\n        const recordName = record.name.replace(/\\.$/, \"\");\n        if (!recordName.endsWith(domain))\n          throw new Error(\n            `Record name \"${recordName}\" is not a subdomain of \"${domain}\".`,\n          );\n        return recordName.slice(0, -(domain.length + 1));\n      }\n\n      function createRecord() {\n        return new DnsRecord(\n          ...transform(\n            args.transform?.record,\n            `${namePrefix}${record.type}Record${nameSuffix}`,\n            {\n              domain: args.domain,\n              type: record.type,\n              name: recordName,\n              value: record.value,\n              mxPriority: record.priority,\n              teamId: DEFAULT_TEAM_ID,\n              ttl: 60,","sourceCodeStart":127,"sourceCodeEnd":163,"githubUrl":"https://github.com/anomalyco/sst/blob/a0bd20f762883e72a35caccb4896c42ce5b3f707/platform/src/components/vercel/dns.ts#L127-L163","documentation":"When creating a DNS record for a Vercel-managed domain, validateRecordName checks that the requested record name ends with the domain being managed; it then strips the domain suffix to compute the relative record name. This error means the record's name is not a subdomain of the configured Vercel domain, so Vercel DNS cannot own/create it.","triggerScenarios":"Creating a sst vercel DNS record where record.name does not end with the configured domain string — e.g. record name 'api.example.com' while domain is 'other.com', or a trailing-dot/typo mismatch like 'api.example.org' vs domain 'example.com'.","commonSituations":"Typos in the domain or record name, using an apex domain record ('example.com') where the code expects a subdomain plus suffix, pointing a record at a domain registered elsewhere, or copy-pasting a record name from another project.","solutions":["Make record.name a subdomain of the domain the Vercel DNS component is configured with, e.g. name: 'api' with domain 'example.com', or name: 'api.example.com'.","Check for typos or mismatched TLDs between record.name and domain ('.org' vs '.com').","Remove a trailing dot mismatch: the code strips one trailing '.', so 'api.example.com.' works but other whitespace does not — trim the input.","If you need a record outside this domain, use a different DNS provider/component that manages that domain instead."],"exampleFix":"// before\nnew sst.vercel.DnsRecord(ctx, \"dns\", { domain: \"example.com\", record: { name: \"api.myapp.com\", type: \"CNAME\", value: target } });\n// after\nnew sst.vercel.DnsRecord(ctx, \"dns\", { domain: \"example.com\", record: { name: \"api.example.com\", type: \"CNAME\", value: target } });","handlingStrategy":"validation","validationCode":"const name = record.name.replace(/\\.$/, \"\");\nif (!name.endsWith(domain)) throw new Error(`record ${name} is not a subdomain of ${domain}`);","typeGuard":"function isSubdomainOf(recordName: string, domain: string): boolean {\n  return recordName.replace(/\\.$/, \"\").endsWith(domain);\n}","tryCatchPattern":"try {\n  await createDnsRecord({ domain, record });\n} catch (e) {\n  if ((e as Error).message.includes(\"is not a subdomain of\")) {\n    throw new Error(`Record \"${record.name}\" must live under \"${domain}\"; check domain/record name`, { cause: e });\n  }\n  throw e;\n}","preventionTips":["Derive record names from the domain variable (e.g. `api.${domain}`) instead of hardcoding strings.","Double-check TLD and spelling match between record.name and the configured domain.","Strip exactly one trailing dot only; trim other whitespace before passing names.","Only create records under domains actually registered/managed by the Vercel DNS component."],"tags":["dns","configuration","validation","vercel"],"backgroundTag":"record-not-subdomain-of-domain","analyzedSha":"a0bd20f762883e72a35caccb4896c42ce5b3f707","analyzedAt":"2026-08-30T11:26:00.383Z","schemaVersion":2},"datasetVersion":"2026-08-30T13:17:10.514Z"}