{"record":{"id":"c9ca783dcfc281cc","repo":"anomalyco/sst","slug":"cannot-provide-both-domain-and-route-use-the","errorCode":null,"errorMessage":"Cannot provide both \"domain\" and \"route\". Use the \"domain\" prop on the \"Router\" component when serving your site through a Router.","messagePattern":"Cannot provide both \"domain\" and \"route\"\\. Use the \"domain\" prop on the \"Router\" component when serving your site through a Router\\.","errorType":"validation","errorClass":"VisibleError","httpStatus":null,"severity":"error","filePath":"platform/src/components/aws/ssr-site.ts","lineNumber":1259,"sourceCode":"            throw new VisibleError(\n              `Region ${region} is not supported by this component. Please select a different AWS region.`,\n            );\n\n          if (!Object.values(Region).includes(region as Region))\n            throw new VisibleError(\n              `Invalid AWS region: \"${region}\". Please specify a valid AWS region.`,\n            );\n          return region as Region;\n        });\n      });\n    }\n\n    function normalizeRoute() {\n      const route = normalizeRouteArgs(args.router, args.route);\n\n      if (route) {\n        if (args.domain)\n          throw new VisibleError(\n            `Cannot provide both \"domain\" and \"route\". Use the \"domain\" prop on the \"Router\" component when serving your site through a Router.`,\n          );\n\n        if (args.edge)\n          throw new VisibleError(\n            `Cannot provide both \"edge\" and \"route\". Use the \"edge\" prop on the \"Router\" component when serving your site through a Router.`,\n          );\n\n        if (args.protection)\n          throw new VisibleError(\n            `Cannot set \"protection\" when routing through a Router. Set \"protection\" on the Router component instead.`,\n          );\n      }\n\n      return route;\n    }\n\n    function normalizeEdge() {","sourceCodeStart":1241,"sourceCodeEnd":1277,"githubUrl":"https://github.com/anomalyco/sst/blob/a0bd20f762883e72a35caccb4896c42ce5b3f707/platform/src/components/aws/ssr-site.ts#L1241-L1277","documentation":"When an SSR site is served through a `Router` via the `route` prop, custom domain configuration must live on the Router itself. Passing both `domain` on the site and `route` is ambiguous and rejected at construction time with this message pointing you to set domain on the Router.","triggerScenarios":"An SSR site component args include both `domain: {...}` and `route: { router }` (or `router`), e.g. after partially migrating from domain-based to router-based serving.","commonSituations":"Following old docs that set `domain` while also adopting a Router; merging config changes where one teammate added a router and another kept the domain.","solutions":["Remove the `domain` prop from the site component","Move the domain configuration to the Router component (`new sst.aws.Router(\"Router\", { domain: \"example.com\" })`)","Deploy again"],"exampleFix":"// before\nnew sst.aws.NextjsSite(\"Web\", {\n  path: \"src\",\n  domain: \"app.example.com\",\n  route: { router },\n});\n// after\nnew sst.aws.NextjsSite(\"Web\", {\n  path: \"src\",\n  route: { router }, // router created with { domain: \"app.example.com\" }\n});","handlingStrategy":"validation","validationCode":"if (siteArgs.domain && siteArgs.route) {\n  throw new Error('Set `domain` on the Router component instead of the site when using `route`');\n}","typeGuard":null,"tryCatchPattern":"try {\n  new sst.aws.NextjsSite(\"Web\", args);\n} catch (e) {\n  if (String(e).includes('Cannot provide both \"domain\" and \"route\"')) console.error(\"Move domain to the Router\");\n  throw e;\n}","preventionTips":["Pick one serving model: standalone (domain) or router-based (route) — not both","When adding a Router, migrate domain config in the same change","Grep site args for `domain:` before enabling route"],"tags":["ssr-site","router","domain","config-conflict"],"backgroundTag":"conflicting-props","analyzedSha":"a0bd20f762883e72a35caccb4896c42ce5b3f707","analyzedAt":"2026-08-30T11:26:00.383Z","schemaVersion":2},"datasetVersion":"2026-08-30T13:17:10.514Z"}