© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
Drizzle TeamDT
Drizzle Team•3y ago•
2 replies
nico

How to use drizzle-zod generated schemas in Next.JS frontend?

I'm currently using the pages dir in Next.JS and I have a function making an API call. I want to pass the returned body into the generated zod schema using zod and drizzle-zod. The problem is, when I import any created schema, I receive this error:

 ⨯ ../../node_modules/.pnpm/postgres@3.3.5/node_modules/postgres/cjs/src/connection.js:1:0
Module not found: Can't resolve 'net'

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

Import trace for requested module:
../../node_modules/.pnpm/postgres@3.3.5/node_modules/postgres/cjs/src/index.js
../../packages/db/dist/db/client.js
../../packages/db/dist/index.js
./src/pages/manage/classes/index.tsx
 ⨯ ../../node_modules/.pnpm/postgres@3.3.5/node_modules/postgres/cjs/src/connection.js:1:0
Module not found: Can't resolve 'net'

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

Import trace for requested module:
../../node_modules/.pnpm/postgres@3.3.5/node_modules/postgres/cjs/src/index.js
../../packages/db/dist/db/client.js
../../packages/db/dist/index.js
./src/pages/manage/classes/index.tsx


This leads me to believe that I can't use my zod schemas because they depend on the drizzle table created with pgTable, which relies on
net
net
. Is there a way around this?
Drizzle TeamJoin
The official Discord for all Drizzle related projects, such as Drizzle ORM, Drizzle Kit, Drizzle Studio and more!
11,879Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

How to use drizzle-zod types in the frontend
Drizzle TeamDTDrizzle Team / help
2mo ago
Share drizzle-zod schemas with the frontend
Drizzle TeamDTDrizzle Team / help
3y ago
Drizzle-zod schemas included in bundle
Drizzle TeamDTDrizzle Team / help
4mo ago
How to import drizzle-zod schemas on the client
Drizzle TeamDTDrizzle Team / help
6mo ago