Using inferred schema types in Next.js client components, 'server-only' breaks Drizzle Studio.
Im working with Next.js 14 app router. I'd like to use Drizzle's inferred types across my application, including client components.
Schema:
Client component:
This is able to run as well as be built without error, but running
npx drizzle-kit studio
it throws the error: "Error: This module cannot be imported from a Client Component module. It should only be used from a Server Component.". Removing import "server-only";
from the Schema file fixes it.
So I am wondering, a) Is it safe to import types from the schema file on the client? b) Is the error thrown from import "server-only";
in the Schema file a problem with my codebase or internal to Drizzle Studio since thats the only place it throws an error?0 Replies