svirinsS
tRPC8mo ago
1 reply
svirins

Prisma ESM (node-postgres) / tRPC 11 / Next.js 15 issue

Hi everyone!

Key components of our stack:

- Prisma 6.9.0 (with pg adapter)
- Next.js 15.3.3
- tRPC 11.3
- Tanstack React Query 5.80.6

We also use Bun

When attempting to migrate to Prisma ESM client using driverAdapters (as described in the documentation), build errors occur:

./node_modules/pg/lib/connection-parameters.js
Module not found: Can't resolve 'dns'

https://nextjs.org/docs/messages/module-not-found

Import trace for requested module:
./node_modules/pg/lib/client.js
./node_modules/pg/lib/index.js
./node_modules/pg/esm/index.mjs
./node_modules/@prisma/adapter-pg/dist/index.mjs
./src/lib/clients/prisma/index.ts
./src/app/our-client-component-with-trpc-call.tsx


The same error occurs for 'fs', 'tls' and so on
Using webpack directives in next.config.mjs doesn't solve the problem
As you can see, the stack trace points to the first tRPC call in the client component.

The project uses standard tRPC 11 configuration for Next.js App Router. For testing purposes, I simplified the tRPC context by removing Clerk authentication and keeping only db

Perhaps someone has encountered a similar issue and can suggest a solution. Unfortunately, using the serverless pg driver is not an option for us - we are tightly coupled to Azure.

Thanks
Was this page helpful?