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
102 stars 19 forks source link

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

Open sarablanchardllc opened 3 months ago

sarablanchardllc commented 3 months 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 3 months ago

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

sarablanchardllc commented 3 months 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.

Cauen commented 1 month ago

Hi @sarablanchardllc
We updated the peerDeps to pothos versions 4+, this solves you problema?

Sorry for the delay :X