anomalyco/sst · error · VisibleError
Cannot provide both "edge" and "route". Use the "edge" prop
Error message
Cannot provide both "edge" and "route". Use the "edge" prop on the "Router" component when serving your site through a Router.
What it means
Edge-function configuration (`edge` prop, for Lambda@Edge SSR) is incompatible with serving the site through a Router. If both `edge` and `route` are set, `normalizeRoute` throws to force you to configure edge behavior on the Router instead.
Source
Thrown at platform/src/components/aws/ssr-site.ts:1264
throw new VisibleError(
`Invalid AWS region: "${region}". Please specify a valid AWS region.`,
);
return region as Region;
});
});
}
function normalizeRoute() {
const route = normalizeRouteArgs(args.router, args.route);
if (route) {
if (args.domain)
throw new VisibleError(
`Cannot provide both "domain" and "route". Use the "domain" prop on the "Router" component when serving your site through a Router.`,
);
if (args.edge)
throw new VisibleError(
`Cannot provide both "edge" and "route". Use the "edge" prop on the "Router" component when serving your site through a Router.`,
);
if (args.protection)
throw new VisibleError(
`Cannot set "protection" when routing through a Router. Set "protection" on the Router component instead.`,
);
}
return route;
}
function normalizeEdge() {
return output([args.edge, args.server?.edge]).apply(
([edge, serverEdge]) => {
if (serverEdge)
throw new VisibleError(
`The "server.edge" prop is deprecated. Use the "edge" prop on the top level instead.`,View on GitHub (pinned to a0bd20f762)
Solutions
- Remove the `edge` prop from the site component args
- If edge is required, drop the `route` prop and configure the site standalone (with domain/protection)
- If Router-based serving is required, manage any edge settings on the Router component
Example fix
// before
new sst.aws.NextjsSite("Web", {
path: "src",
edge: true,
route: { router },
});
// after
new sst.aws.NextjsSite("Web", {
path: "src",
route: { router },
}); Defensive patterns
Strategy: validation
Validate before calling
if (siteArgs.edge && siteArgs.route) {
throw new Error('Remove `edge` when using `route`; configure edge on the Router if needed');
} Try / catch
try {
new sst.aws.NextjsSite("Web", args);
} catch (e) {
if (String(e).includes('Cannot provide both "edge" and "route"')) console.error("Drop `edge` or drop `route`");
throw e;
} Prevention
- Treat `edge` and `route` as mutually exclusive in your config helpers
- Document the serving model (edge vs router) for the team
- Validate site args in a shared factory function before constructing components
When it happens
Trigger: An SSR site component args include both `edge: true` (or an edge config object) and `route: { router }`.
Common situations: Migrating a site that previously used Lambda@Edge to router-based serving; enabling `edge` per old guides while the project also uses a Router for path-based routing.
Related errors
- Cannot provide both "domain" and "route". Use the "domain" p
- Cannot set "protection" when routing through a Router. Set "
- "cdn" prop is deprecated. Use the "route.router" prop instea
- Only one of function, queue, or topic is allowed for the "${
- type === "service" ? `You cannot provide both "containers" a
AI-assisted analysis of anomalyco/sst@a0bd20f762 (2026-08-30).
Data as JSON: /api/errors/b53ef4dee057fa66.
Report an issue: GitHub.