Next.js 16.3 + Bun runtime (1.3.12) build failure on Vercel, while Bun 1.3.14 works locally

Hi everyone,

I’m trying to upgrade one of my projects from Next.js 16.2.12 to 16.3, and I’ve run into what appears to be a Bun runtime compatibility issue on Vercel.

My setup

  • Next.js 16.3
  • Bun runtime (bun --bun next build)
  • Vercel currently uses Bun 1.3.12
  • My local machine uses Bun 1.3.14

What happens

On Vercel, the build compiles successfully and TypeScript completes successfully, but it fails during the “Collecting page data” step with the following error:

Error: Failed to load external module next/dist/compiled/next-server/app-page-turbo.runtime.prod.js:
TypeError: Expected CommonJS module to have a function wrapper.
If you weren't messing around with Bun's internals, this is a bug in Bun.

What I’ve tested

I wanted to make sure this wasn’t caused by my own project, so I tried several things:

  • My project builds successfully on Next.js 16.2.12.
  • On my local machine with Bun 1.3.14, everything works correctly:
    • bun run dev
    • bun run build
    • bun run start
  • I also created a brand new Next.js 16.3 project from scratch, enabled the Bun runtime (bun --bun next build), and I was able to reproduce the same issue on Vercel.

Because of that, I’m wondering if this is related to the Bun version currently used by Vercel rather than to my application itself.

Has anyone else experienced this after upgrading to Next.js 16.3?

Is there currently any way to use a newer Bun version (such as 1.3.14) on Vercel, or is the runtime version fixed until Vercel updates it?

I’ll attach the build logs and screenshots below.

Thanks!

As an additional test, I also removed Bun as the runtime for the build while keeping Bun enabled for the Serverless Functions.

The build completed successfully, but every Server Function immediately returned an Internal Server Error at runtime.

The only configuration that currently works reliably for me is to use Bun only as the package manager, while letting Next.js run with the default runtime for both the build and the Serverless Functions.

Hopefully this additional information helps narrow down where the issue might be.

Pretty much the same problem here.

Since updating to 16.3, `bun run build` (1.3.14) fails on my Railway deployment, although it works locally.
Reverting back to 16.2.12 fixed the issue

Hi CoffeePuma55644,

Since you reproduced it with a fresh Next.js 16.3 app, I’d treat this as a compatibility issue between Next.js 16.3 and the Bun runtime path, not just your application code.

There are two separate things to separate here:

# Bun as package manager
bun install

# Bun as the runtime used to execute the Next build
bun run --bun next build

For the Function runtime, Vercel’s Bun config currently uses:

{
  "bunVersion": "1.x"
}

and Vercel manages the minor/patch version, so I wouldn’t assume you can force Functions specifically onto 1.3.14 from vercel.json.

For the build/install side, Vercel has a KB article for pinning Bun in the Install Command, so you could try this as a narrow test:

bunx bun@1.3.14 install

If that still fails during “Collecting page data,” then the issue probably is not just the install-time Bun version. In that case, your current workaround is the one I’d use for production: keep Bun only as the package manager if you want, remove the Bun runtime config, use the normal next build path, or temporarily stay on Next.js 16.2.12.

If you can share the minimal repro’s package.json scripts and vercel.json, that should make it much easier for Vercel/Bun maintainers to confirm whether the failure is in the build runtime, Functions runtime, or the Next.js 16.3 output.