You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm new to Next.js and currently developing within a VS Code dev container. My goal is to host a Next.js app (with SSR) on Azure Web Apps. To prepare for that, I've set output: "standalone" in my next.config.js.
Running locally with next dev works fine. However, when I build the app using next build and try to run the server with node .next/standalone/server.js, the process starts but seems to hang — it doesn’t respond to requests.
Here’s the preview script I have in my package.json:
"preview": "HOSTNAME=localhost && next build && cp -r public .next/standalone/ && cp -r .next/static .next/standalone/.next/ && node .next/standalone/server.js"
I’ve also explicitly set the HOSTNAME=localhost environment variable. Still, the server doesn’t appear to respond after startup.
Has anyone else run into this? Any suggestions for how to get server.js to start correctly and serve requests in this setup?
Thanks in advance!
Additional information
Mydevcontainer.json file:
{"name": "nextjs-app","image": "mcr.microsoft.com/devcontainers/typescript-node:1-20-bookworm",// Features to add to the dev container. More info: https://containers.dev/features."features": {"ghcr.io/devcontainers/features/azure-cli:1": {"version": "latest","extensions": "azure-devops"}},// Configure tool-specific properties."customizations": {"vscode": {"extensions": ["dbaeumer.vscode-eslint","esbenp.prettier-vscode","yoavbls.pretty-ts-errors","christian-kohler.path-intellisense","ms-azure-devops.azure-pipelines","davidanson.vscode-markdownlint","yzhang.markdown-all-in-one","pomdtr.excalidraw-editor","ms-azuretools.vscode-azure-github-copilot","humao.rest-client","ms-azuretools.vscode-bicep"]}}}
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
Summary
Hi all,
I'm new to Next.js and currently developing within a VS Code dev container. My goal is to host a Next.js app (with SSR) on Azure Web Apps. To prepare for that, I've set
output: "standalone"
in my next.config.js.Running locally with
next dev
works fine. However, when I build the app usingnext build
and try to run the server withnode .next/standalone/server.js
, the process starts but seems to hang — it doesn’t respond to requests.Here’s the preview script I have in my package.json:
I’ve also explicitly set the
HOSTNAME=localhost
environment variable. Still, the server doesn’t appear to respond after startup.Has anyone else run into this? Any suggestions for how to get server.js to start correctly and serve requests in this setup?
Thanks in advance!
Additional information
Example
No response
Beta Was this translation helpful? Give feedback.
All reactions