How do I deploy a Next.js app to Azure App Service?

asked 21 days ago160 viewsen

5

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.

asked 21 days ago

3 Answers

8
Accepted answer

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.

answered 21 days ago
7

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.

answered 21 days ago
1

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.

answered 21 days ago

Sign in and verify your email to post an answer.