anomalyco/sst · error · VisibleError
The "routeSite" function has been deprecated. Configure the
Error message
The "routeSite" function has been deprecated. Configure the new "route" prop on the site component to route the site through this Router.
What it means
`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.
Source
Thrown at platform/src/components/aws/router.ts:2654
routeArgs: args,
},
{ provider: this.constructorOpts.provider },
);
},
);
}
/**
* Add a route to a frontend or static site.
*
* @param pattern The path prefix to match for this route.
* @param site The frontend or static site to route matching requests to.
*
* @deprecated The `routeSite` function has been deprecated. Set the `route` on the
* site components to route the site through this Router.
*/
public routeSite(pattern: Input<string>, site: any) {
throw new VisibleError(
`The "routeSite" function has been deprecated. Configure the new "route" prop on the site component to route the site through this Router.`,
);
}
/** @internal */
public getSSTLink() {
return {
properties: {
url: this.url,
},
};
}
/**
* Reference an existing Router with the given Router distribution ID.
*
* @param name The name of the component.
* @param distributionID The ID of the existing Router distribution.View on GitHub (pinned to a0bd20f762)
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
Example fix
// before
router.routeSite("/web/*", site);
// after
new Nextjs($app, "Site", {
route: { router, pattern: "/web/*" },
}); Defensive patterns
Strategy: validation
Validate before calling
if (typeof (router as any).routeSite === "function" &&
(router as any).routeSite.length >= 0 &&
process.env.SST_MAJOR_VERSION && Number(process.env.SST_MAJOR_VERSION.split(".")[0]) >= 4) {
throw new Error("routeSite is removed; use the site component's `route` prop");
} Try / catch
try {
router.routeSite("/web/*", site);
} catch (e) {
if (String(e).includes("routeSite")) {
console.error("Migrate to site component `route` prop");
}
throw e;
} Prevention
- 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
When it happens
Trigger: Any call to `router.routeSite(pattern, site)` on a Router instance — the method body always throws.
Common situations: Following older SST tutorials/docs or upgrading a project written against the pre-`route`-prop SST API.
Related errors
- sst.aws.linkable is deprecated. Use sst.Linkable.wrap instea
- Cannot set "protection" on a Router with inline routes. Use
- There have been some minor changes to the "Router" component
- In "${name}" Router, the route path "${path}" must start wit
- In "${name}" Router, the route path "${path}" can only have
AI-assisted analysis of anomalyco/sst@a0bd20f762 (2026-08-30).
Data as JSON: /api/errors/df615ee775f0b342.
Report an issue: GitHub.