anomalyco/sst · error · VisibleError
"cdn" prop is deprecated. Use the "route.router" prop instea
Error message
"cdn" prop is deprecated. Use the "route.router" prop instead to use an existing "Router" component to serve your site.
What it means
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.
Source
Thrown at platform/src/components/aws/ssr-site.ts:1179
this.bucket = bucket;
this.cdn = distribution;
this.server = server;
this.prodUrl = prodUrl;
this.registerOutputs({
_hint: this.url,
_metadata: {
mode: "deployed",
path: sitePath,
url: this.url,
edge: false,
server: server.arn,
},
});
function validateDeprecatedProps() {
if (args.cdn !== undefined)
throw new VisibleError(
`"cdn" prop is deprecated. Use the "route.router" prop instead to use an existing "Router" component to serve your site.`,
);
}
function normalizeDev() {
const enabled = $dev && args.dev !== false;
const devArgs = args.dev || {};
return {
enabled,
url: output(devArgs.url ?? URL_UNAVAILABLE),
outputs: {
title: devArgs.title,
command: output(devArgs.command ?? "npm run dev"),
autostart: output(devArgs.autostart ?? true),
directory: output(devArgs.directory ?? sitePath),
environment: args.environment,
links: output(args.link || [])View on GitHub (pinned to a0bd20f762)
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
Example fix
// before
new sst.aws.NextjsSite("Web", {
cdn: { cfnDistribution: dist },
});
// after
const router = new sst.aws.Router("Router", { domain: "example.com" });
new sst.aws.NextjsSite("Web", {
route: { router },
}); Defensive patterns
Strategy: validation
Validate before calling
const siteArgs = { path: "src" } as Record<string, unknown>;
if ("cdn" in siteArgs) throw new Error("Remove deprecated `cdn` prop; use route.router"); Try / catch
try {
new sst.aws.NextjsSite("Web", args);
} catch (e) {
if (String(e).includes('"cdn" prop is deprecated')) console.error("Migrate cdn -> route.router");
throw e;
} Prevention
- 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
When it happens
Trigger: 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.
Common situations: 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).
Related errors
- There have been some minor changes to the "Router" component
- Invalid route type
- The "routeSite" function has been deprecated. Configure the
- Cannot provide both "domain" and "route". Use the "domain" p
- Cannot provide both "edge" and "route". Use the "edge" prop
AI-assisted analysis of anomalyco/sst@a0bd20f762 (2026-08-30).
Data as JSON: /api/errors/108688b3a86208a7.
Report an issue: GitHub.