Skip to content
Discussion options

You must be logged in to vote

Prisma can't run directly in Storybook because Storybook's preview environment (especially with Vite/React) is browser-based and doesn't provide Node.js globals like process that Prisma needs. That's why you see the 'process is not defined' error—Prisma expects a Node.js server, but Storybook stories run in the browser context, which can't access your database or Node APIs source.

To test components that rely on database data (like pagination), the best practice is to mock your data layer. You can do this by mocking modules, using tools like MSW (Mock Service Worker) to intercept API calls, or providing mock data directly in your stories. If you want to simulate real backend interactions…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by tajbowness
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Help
Labels
None yet
1 participant