anomalyco/sst · error · VisibleError
Lambda@Edge runtime is deprecated. Update your OpenNext…
Error message
Lambda@Edge runtime is deprecated. Update your OpenNext configuration to use the standard Lambda runtime and deploy to multiple regions using the "regions" option in your Nextjs component.
What it means
During Nextjs build-plan generation, SST inspects the OpenNext output for edge functions. Deploying Next.js middleware or routes to Lambda@Edge is deprecated in SST, so any edgeFunctions entries cause this VisibleError directing you to the standard Lambda runtime plus the regions option.
Solutions
- Remove edge runtime usage (e.g. middleware `runtime: "edge"`) so OpenNext builds standard Lambda functions
- Use the `regions` option on the sst.aws.Nextjs component to deploy to multiple regions instead of Lambda@Edge
- Regenerate the app with `opennextjs build` and verify .open-next output has no edgeFunctions, then re-deploy
Example fix
// before
// middleware.ts
export const config = { runtime: "edge" };
// after
// middleware.ts (no edge runtime)
export const config = { matcher: "/about/:path*" };
// and in sst.config.ts
new sst.aws.Nextjs("Web", { regions: ["us-east-1", "eu-west-1"] }); Defensive patterns
Strategy: validation
Validate before calling
// After building with OpenNext, before deploying
const out = JSON.parse(fs.readFileSync(".open-next/open-next.output.json"));
if (Object.keys(out.edgeFunctions ?? {}).length > 0) {
throw new Error("Edge functions detected: migrate off Lambda@Edge");
} Type guard
function hasEdgeFunctions(out: OpenNextOutput): boolean {
return Object.keys(out.edgeFunctions ?? {}).length > 0;
} Prevention
- Remove `runtime: "edge"` from middleware and route handlers
- Use the Nextjs `regions` option for multi-region instead of Lambda@Edge
- Keep OpenNext config and SST component versions aligned with current docs
- Inspect .open-next/open-next.output.json in CI to catch edgeFunctions early
When it happens
Trigger: Building a Nextjs component whose OpenNext build output (.open-next/open-next.output.json) contains one or more edgeFunctions, e.g. middleware configured with `runtime: "edge"` or edge runtime route handlers.
Common situations: Older Next.js apps using `export const runtime = "edge"` for middleware; OpenNext configs that still target Lambda@Edge; following outdated deployment guides.
Related errors
- Could not load OpenNext output file at
- Failed to detect Next.js version. Using OpenNext v
- Base path configuration not found in…
- Build ID not found in ".next/BUILD_ID" for site
- "cdn" prop is deprecated. Use the "route.router" prop…
AI-assisted analysis of anomalyco/sst@a0bd20f762 (2026-08-30).
Data as JSON: /api/errors/264f367ad138dce9.
Report an issue: GitHub.
Appendix: source
Thrown at platform/src/components/aws/nextjs.ts:624
},
);
}
protected buildPlan(
outputPath: Output<string>,
name: string,
args: NextjsArgs,
{ bucket }: { bucket: Bucket },
): Output<Plan> {
const parent = this;
const ret = all([outputPath, args?.imageOptimization]).apply(
([outputPath, imageOptimization]) => {
const { openNextOutput, buildId, prerenderManifest, base } =
loadBuildOutput();
if (Object.entries(openNextOutput.edgeFunctions).length) {
throw new VisibleError(
`Lambda@Edge runtime is deprecated. Update your OpenNext configuration to use the standard Lambda runtime and deploy to multiple regions using the "regions" option in your Nextjs component.`,
);
}
const { revalidationQueue, revalidationFunction } =
createRevalidationQueue();
const revalidationTable = createRevalidationTable();
createRevalidationTableSeeder();
const serverOrigin = openNextOutput.origins["default"];
const imageOptimizerOrigin = openNextOutput.origins["imageOptimizer"];
const s3Origin = openNextOutput.origins["s3"];
const plan = all([
revalidationTable?.arn,
revalidationTable?.name,
bucket.arn,
bucket.name,
getRegionOutput(undefined, { parent: bucket }).region,View on GitHub (pinned to a0bd20f762)