{"record":{"id":"df615ee775f0b342","repo":"anomalyco/sst","slug":"the-routesite-function-has-been-deprecated-conf","errorCode":null,"errorMessage":"The \"routeSite\" function has been deprecated. Configure the new \"route\" prop on the site component to route the site through this Router.","messagePattern":"The \"routeSite\" function has been deprecated\\. Configure the new \"route\" prop on the site component to route the site through this Router\\.","errorType":"exception","errorClass":"VisibleError","httpStatus":null,"severity":"error","filePath":"platform/src/components/aws/router.ts","lineNumber":2654,"sourceCode":"            routeArgs: args,\n          },\n          { provider: this.constructorOpts.provider },\n        );\n      },\n    );\n  }\n\n  /**\n   * Add a route to a frontend or static site.\n   *\n   * @param pattern The path prefix to match for this route.\n   * @param site The frontend or static site to route matching requests to.\n   *\n   * @deprecated The `routeSite` function has been deprecated. Set the `route` on the\n   * site components to route the site through this Router.\n   */\n  public routeSite(pattern: Input<string>, site: any) {\n    throw new VisibleError(\n      `The \"routeSite\" function has been deprecated. Configure the new \"route\" prop on the site component to route the site through this Router.`,\n    );\n  }\n\n  /** @internal */\n  public getSSTLink() {\n    return {\n      properties: {\n        url: this.url,\n      },\n    };\n  }\n\n  /**\n   * Reference an existing Router with the given Router distribution ID.\n   *\n   * @param name The name of the component.\n   * @param distributionID The ID of the existing Router distribution.","sourceCodeStart":2636,"sourceCodeEnd":2672,"githubUrl":"https://github.com/anomalyco/sst/blob/a0bd20f762883e72a35caccb4896c42ce5b3f707/platform/src/components/aws/router.ts#L2636-L2672","documentation":"`Router.routeSite()` has been removed/deprecated. Site components (Nextjs, Astro, Remix, etc.) now expose a `route` prop that wires the site into the Router, so calling the old method unconditionally throws a VisibleError with migration guidance.","triggerScenarios":"Any call to `router.routeSite(pattern, site)` on a Router instance — the method body always throws.","commonSituations":"Following older SST tutorials/docs or upgrading a project written against the pre-`route`-prop SST API.","solutions":["Remove the `router.routeSite(...)` call and instead set the `route` prop on the site component (e.g. `new Nextjs(..., { route: { router, pattern } })`)","Consult the current SST docs for the site component's `route` options","If you need path-prefix routing without a site `route` prop, use `router.route(pattern, url)` pointing at the deployed site URL"],"exampleFix":"// before\nrouter.routeSite(\"/web/*\", site);\n// after\nnew Nextjs($app, \"Site\", {\n  route: { router, pattern: \"/web/*\" },\n});","handlingStrategy":"validation","validationCode":"if (typeof (router as any).routeSite === \"function\" &&\n    (router as any).routeSite.length >= 0 &&\n    process.env.SST_MAJOR_VERSION && Number(process.env.SST_MAJOR_VERSION.split(\".\")[0]) >= 4) {\n  throw new Error(\"routeSite is removed; use the site component's `route` prop\");\n}","typeGuard":null,"tryCatchPattern":"try {\n  router.routeSite(\"/web/*\", site);\n} catch (e) {\n  if (String(e).includes(\"routeSite\")) {\n    console.error(\"Migrate to site component `route` prop\");\n  }\n  throw e;\n}","preventionTips":["Search the codebase for routeSite after SST upgrades and replace with the site `route` prop","Follow SST migration guides when bumping major versions","Wire site-to-router routing at site construction time, not via Router methods"],"tags":["deprecation","router","api-migration","sst"],"backgroundTag":"deprecated-api-removed","analyzedSha":"a0bd20f762883e72a35caccb4896c42ce5b3f707","analyzedAt":"2026-08-30T11:26:00.383Z","schemaVersion":2},"datasetVersion":"2026-08-30T13:17:10.514Z"}