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 plugin failing on call to builder.prismaObject() #1190
Comments
NOTE: the builder.toSchema({}) does load in a vitest unit test. (in test environment it works) In cloudflare worker, when you run [wrangler dev], the schemal builder fails loading the PrismaObject |
It looks like prisma has remove the I think potentially the fix for this would be to update the pothos prisma generator to genersate a minimal version of the dmmf that includes the information needed for pothos to build the graphql schema. I haven't done a deep dive on what this would require, or if there are other options. Definitely open to help on figuring out the best way to fix this |
@hayes i logged the bug with prisma => prisma/prisma#23913 I looked at your code, and the only thing pothos SchemaBuilder needs is the slimmed down version of the Prisma.dmmf. (the latest dmmf removes the extra "schema" and "mapping' properties. => so if we can access Prisma.dmmf then we are good for the SchemaBuilder. ==> i tested the Prisma.dmmf json (i persisted json to file manually, and set dmmf property for SchemaBuilder and it it works. ==> i asked the Prisma team to reenable Prisma.dmmf for edge (as per ticket #23913) I also looked your pothos plugin-prisma generator, and its easy enough to extract the [dmmf.datamodel] property either to separate file, or same ./types file that you generate (and add in extra property). i can either create a PR and request to update your plugin-prisma, or i can create a new Prisma generator, just to create this dmmf.datramodel json temporarily until the Prisma team renables Prisma.dmmf. what are your thought? Should i do the PR or create a new prisma generator? |
Let's wait to see what Prisma recommends before fixing in Pothos I don't want to update this multiple times of they can provide a quick fix |
If prismas recommendation is to generate the output in a pothos generator, I'd probably add it as a flag similar to the Then you would just import the datamodel alongside the prisma types and pass it into the existing dmmf option for the prisma plugin |
I probably wouldn't add compression in Pothos itself, I think compressing/decomressing could manually in apps, but I wouldn't want a pothos plugin to ship with a dependency on a compression package |
@hayes i think Prisma. the [runtimeDataModel] will work. we just need access to this value accessible by the edge runtime via Prisma.dmmf Prisma was open to doing this, as as the latest comments on prisma/prisma#23913) |
In a Prisma+Pothos+CloudFlare Worker context the following error happens at boot.
Using
NOTE: as of Prisma >=5.11, they support native database connections (using pg)
more info: https://www.prisma.io/docs/orm/prisma-client/deployment/edge/deploy-to-cloudflare#postgresql-traditional
==> it no longer need @prisma/client/edge to run in cloudflare worker edge environment (no need for prisma accelerate)
The text was updated successfully, but these errors were encountered: