Cauen / prisma-generator-pothos-codegen

The fastest way to create a fully customizable CRUD Graphql API from Prisma Schema.
https://www.npmjs.com/package/prisma-generator-pothos-codegen
95 stars 16 forks source link

Need support for @pothos/plugin-prisma: v4, for Edge environments #72

Open sarablanchardllc opened 1 month ago

sarablanchardllc commented 1 month ago

Access to Prisma.dmmf was removed in edge environments: https://github.com/prisma/prisma/pull/22962

This caused issues with @pothos/plugin-prisma which was then fixed in v4: https://github.com/hayes/pothos/issues/1190

Dep requirements for Edge:

Relevant package.json info:

Screenshot 2024-08-10 at 2 51 40 AM

schema.prisma:

Screenshot 2024-08-10 at 3 09 58 AM

Error in graphql/builder.ts

Screenshot 2024-08-10 at 2 51 00 AM

Please let me know if I need to provide more information.

ad6025b commented 1 month ago

@sarablanchardllc you need to change the from to reference the generated type image

sarablanchardllc commented 1 month ago

@sarablanchardllc you need to change the from to reference the generated type

The file I was targeting is the generated pothos-type.ts, it just lives in the same folder as the schema.prisma file (root/prisma).

"getDataModel" is found properly when running "@pothos/plugin-prisma" is at version 4.0.0. The prisma plugin for prismos doesn't generate "getDataModel" within the "generated pothos-types.ts" file when using an earlier version.