Skip to content

Instantly share code, notes, and snippets.

@paralin
Created February 20, 2026 02:27
Show Gist options
  • Select an option

  • Save paralin/b6122f55896eb40b88aeebb211c7e496 to your computer and use it in GitHub Desktop.

Select an option

Save paralin/b6122f55896eb40b88aeebb211c7e496 to your computer and use it in GitHub Desktop.

Bun + Next.js 16 + Turbopack + Prisma 7 Compatibility Issues

We hit a blocking issue deploying a Next.js 16 app with Prisma 7 in a Docker container using oven/bun:1-alpine. The issue forced us to switch to Node.js + pnpm.

The Problem

When running bun run dev (which invokes next dev with Turbopack, the default bundler in Next.js 16), Turbopack generates hashed external module references that Bun's runtime cannot resolve.

Error

Error: Failed to load external module @prisma/client-2c3a283f134fdcb6/runtime/client:
ResolveMessage: Cannot find module '@prisma/client-2c3a283f134fdcb6/runtime/client'
from '/app/.next/dev/server/chunks/ssr/[root-of-the-server]__9504adac._.js'

The actual package is @prisma/client -- Turbopack appends a content hash (-2c3a283f134fdcb6) to the package name when marking it as an SSR external. Node.js resolves this correctly; Bun does not.

What We Tried

  1. serverExternalPackages in next.config.ts -- same error, Bun can't resolve hashed names
  2. transpilePackages -- fixes @prisma/client but then the same issue cascades to @libsql/client, then libsql (native bindings). Whack-a-mole.
  3. Removing @prisma/adapter-libsql entirely -- Prisma 7's prisma-client generator requires an adapter; new PrismaClient() without options throws PrismaClientInitializationError
  4. --no-turbopack -- not supported in Next.js 16 (Turbopack is the only dev bundler)
  5. Clearing .next cache and full container recreates -- no effect
  6. Named Docker volumes vs bind mounts for node_modules -- no effect

Root Cause

Confirmed by a Next.js maintainer in vercel/next.js#86866:

"I recommend that you report this to bun" -- the problem doesn't occur with Node.js runtime, only with Bun's runtime when using Turbopack.

Also tracked in:

  • vercel/next.js#87737 -- Turbopack generates external module references with hashes that don't match installed packages
  • prisma/prisma#28956 -- Failed to load @prisma/client module with Next.js 15 + Bun + Turbopack

The Fix

Switched from oven/bun:1-alpine to node:22-alpine in Docker. Using pnpm as the package manager. The same codebase works perfectly under Node.js -- Turbopack's hashed external references resolve correctly.

Environment

  • Next.js 16.1.6
  • Prisma 7.4.1 (prisma-client generator)
  • @prisma/adapter-libsql 7.4.1
  • Bun 1.3.9 (oven/bun:1-alpine Docker image)
  • Linux x64 (Docker on VPS)

Impact

This is a complete blocker for using Bun as a runtime for Next.js 16 apps that use Prisma (or any package that Turbopack marks as an SSR external). The dev server simply cannot start. There is no workaround within Bun -- you must switch to Node.js.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment