How do I deploy a Next.js app to Azure App Service?
asked 21 days ago160 viewsen
I want to deploy a Next.js 15 app (App Router) to Azure App Service, not Vercel.
What's the right Node runtime setting, and how do I handle the standalone output and environment variables?
🤖 AI diagnosis
AI-generated. Not an answer — the community below confirms or corrects it. Always verify before relying on it.
3 Answers
In 2026, uv is the fastest and simplest: uv venv, uv pip install, and a pyproject.toml + uv.lock committed. It replaces pip/venv/pip-tools and is compatible with Poetry-style metadata.
Sign in to tell others whether this worked.
Set output: 'standalone' in next.config, deploy the .next/standalone folder, and set the App Service startup command to node server.js. Use WEBSITE_NODE_DEFAULT_VERSION = ~20 and configure env vars under Configuration → Application settings.
Sign in to tell others whether this worked.
Don't call setState in map. Compute the derived value directly:
const total = items.reduce((s, i) => s + i.price, 0);
If you truly need state, set it once in an effect with the computed result, not per iteration.
Sign in to tell others whether this worked.
Sign in and verify your email to post an answer.