Tim Neutkens edited this page Jun 26, 2018 · 8 revisions

Deploying a Next.js app is pretty simple. You could deploy it almost anywhere Node.js is supported.

Deploying Multiple Instances

It's pretty common to use multiple instances of your app if it's getting more traffic. Then make sure to build your app with next build once and start multiple instances with next start

Otherwise, it's possible for your app to reload when your users navigate between pages.


We generate a unique BUILD_ID for each time when you run next build. We use that id to detect new versions from the client side. If the client side app detects a new BUILD_ID it'll reload the page. With that, your users will use the latest version of your app always.

Since now you've multiple BUILD_IDs in different instances, our client side app thinks it's a new version and it tries to reload the app.

Hot Fix

The best fix is to build the app once with next build and run many instances. Sometimes this is not possible. Then in those cases, you could override the BUILD_ID with your own id. Here's how to do it.

Running Different Versions

Specially with rolling-deployment techniques, it's possible to have two versions of your app running behind a single domain name.

If that's the case, make sure to use Sticky Sessions (or a similar method) to route all the traffic from a given user to the same version. Otherwise, you'll see errors when loading JavaScript assets and pages.

See also


You can’t perform that action at this time.
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.
Press h to open a hovercard with more details.