{"record":{"id":"108688b3a86208a7","repo":"anomalyco/sst","slug":"cdn-prop-is-deprecated-use-the-route-router-p","errorCode":null,"errorMessage":"\"cdn\" prop is deprecated. Use the \"route.router\" prop instead to use an existing \"Router\" component to serve your site.","messagePattern":"\"cdn\" prop is deprecated\\. Use the \"route\\.router\" prop instead to use an existing \"Router\" component to serve your site\\.","errorType":"validation","errorClass":"VisibleError","httpStatus":null,"severity":"error","filePath":"platform/src/components/aws/ssr-site.ts","lineNumber":1179,"sourceCode":"    this.bucket = bucket;\n    this.cdn = distribution;\n    this.server = server;\n    this.prodUrl = prodUrl;\n\n    this.registerOutputs({\n      _hint: this.url,\n      _metadata: {\n        mode: \"deployed\",\n        path: sitePath,\n        url: this.url,\n        edge: false,\n        server: server.arn,\n      },\n    });\n\n    function validateDeprecatedProps() {\n      if (args.cdn !== undefined)\n        throw new VisibleError(\n          `\"cdn\" prop is deprecated. Use the \"route.router\" prop instead to use an existing \"Router\" component to serve your site.`,\n        );\n    }\n\n    function normalizeDev() {\n      const enabled = $dev && args.dev !== false;\n      const devArgs = args.dev || {};\n\n      return {\n        enabled,\n        url: output(devArgs.url ?? URL_UNAVAILABLE),\n        outputs: {\n          title: devArgs.title,\n          command: output(devArgs.command ?? \"npm run dev\"),\n          autostart: output(devArgs.autostart ?? true),\n          directory: output(devArgs.directory ?? sitePath),\n          environment: args.environment,\n          links: output(args.link || [])","sourceCodeStart":1161,"sourceCodeEnd":1197,"githubUrl":"https://github.com/anomalyco/sst/blob/a0bd20f762883e72a35caccb4896c42ce5b3f707/platform/src/components/aws/ssr-site.ts#L1161-L1197","documentation":"The `cdn` prop on SSR site components (NextjsSite, AstroSite, SolidStartSite, etc.) has been deprecated in favor of routing through a `Router` component. SST now hard-fails instead of silently ignoring the prop, telling you to use `route.router` to attach an existing Router for serving the site.","triggerScenarios":"Passing `cdn: <distribution or props>` in the args of an SSR site component and deploying; typically after upgrading SST from a version where `cdn` was supported.","commonSituations":"Upgrading an SST app that gave the site a custom CloudFront distribution via `cdn`; the deploy fails during component construction (validateDeprecatedProps called from the constructor).","solutions":["Remove the `cdn` prop from the site component args","Create an `sst.aws.Router` component and pass it via `route: { router }` to serve the site","Point your custom domain at the Router instead of a hand-built distribution"],"exampleFix":"// before\nnew sst.aws.NextjsSite(\"Web\", {\n  cdn: { cfnDistribution: dist },\n});\n// after\nconst router = new sst.aws.Router(\"Router\", { domain: \"example.com\" });\nnew sst.aws.NextjsSite(\"Web\", {\n  route: { router },\n});","handlingStrategy":"validation","validationCode":"const siteArgs = { path: \"src\" } as Record<string, unknown>;\nif (\"cdn\" in siteArgs) throw new Error(\"Remove deprecated `cdn` prop; use route.router\");","typeGuard":null,"tryCatchPattern":"try {\n  new sst.aws.NextjsSite(\"Web\", args);\n} catch (e) {\n  if (String(e).includes('\"cdn\" prop is deprecated')) console.error(\"Migrate cdn -> route.router\");\n  throw e;\n}","preventionTips":["After SST upgrades, grep sst.config.ts for removed props (`cdn`)","Use route.router for custom-domain/distribution needs going forward","Pin SST versions in CI and read upgrade guides before bumping"],"tags":["deprecation","ssr-site","router","cloudfront"],"backgroundTag":"deprecated-prop","analyzedSha":"a0bd20f762883e72a35caccb4896c42ce5b3f707","analyzedAt":"2026-08-30T11:26:00.383Z","schemaVersion":2},"datasetVersion":"2026-08-30T13:17:10.514Z"}