Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prisma Monorepo Support #690

Open
vinnymac opened this issue Dec 28, 2024 · 1 comment
Open

Prisma Monorepo Support #690

vinnymac opened this issue Dec 28, 2024 · 1 comment

Comments

@vinnymac
Copy link

I raised this on Discord, where I was asked to create this issue, so I am x-posting the feature request to GitHub.

Background

When using a NodeJS monorepo such as Turborepo, Lerna, Yarn, NX, etc, it is currently not possible to use DBOS with Prisma. You receive an error that the @prisma/client node module cannot be found.

This is due to the following lines of code:

// TODO: make Prisma work with debugger proxy.
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-require-imports
const { PrismaClient } = require(path.join(process.cwd(), "node_modules", "@prisma", "client")); // Find the prisma client in the node_modules of the current project

In various monorepos it is considered best practice to keep the Prisma schema and client in a separate workspace package, and the @prisma/client module itself is often located in the root projects node modules folder.

Expectation

DBOS on Prisma works as normal in monorepos without throwing an error.

What have I tried?

I went ahead and applied a small patch to the aforementioned lines in a Turborepo, and confirmed that it works fine if you let it know where the root of the monorepo is located, as then it is able to locate the @prisma/client correctly. This works for my needs, but I imagine an official solution would be preferred by the community.

If I run into any other issues with monorepos I will let DBOS know, as I am integrating with DBOS for the first time in a Typescript based Turborepo project.

@apoliakov
Copy link
Member

Thanks @vinnymac we'll take a look!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants