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

posée 21 days ago159 vuesen

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?

🤖 Diagnostic IA

Généré par IA. Ce n'est pas une réponse — la communauté ci-dessous le confirme ou le corrige. Vérifiez toujours avant de vous y fier.

posée 21 days ago

3 réponses

8
Réponse acceptée

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.

Connectez-vous pour dire si ça a marché.

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.

Connectez-vous pour dire si ça a marché.

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.

Connectez-vous pour dire si ça a marché.

answered 21 days ago

Sign in and verify your email to post an answer.