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 5.12 client for edge runtime disabled the [Prisma.dmmf] property for wasm client #23913
Comments
Michael is right here, we've removed a property from edge build to save on the bundle size, since most of our users don't use Generally, ideal way to proceed for |
Pothos already uses prisma._runtimeDataModel by default. I think the issue is that it was reduced further for edge environments in the latest version. I think the things removed were the relations and indexes (but I haven't looked closely) |
this data was available in |
It would be relatively straightforward to write a generator that generates all the needed data in the existing format. I'm open to suggestions here |
@SevInf @hayes i tried the [runtimeDataMdel] from the edge.js that is generated for the prisma client, and pothos works with this. @SevInf pothos this will work with [runtimeDataMdel]. If you can allow Prisma.dmmf to be accessible from edge runtime, and get this [runtimeDataMdel] value, it will work. @hayes i dont see a need to generate this twice. IMHO, i think Prisma should allow access to this value, and we should be good to go. |
I am using runtimeDataMdel for automatic GraphQL generation. Currently, we are using this to work around the problem. import fs from 'fs';
const srcPath = 'node_modules/.prisma/client/index.js';
const destPath = 'node_modules/.prisma/client/wasm.js';
const src = fs.readFileSync(srcPath);
const runtimeDataModel = String(src).match(/config\.runtimeDataModel = JSON\.parse\(".*"\)/)?.[0];
if (runtimeDataModel) {
const dist = fs.readFileSync(destPath);
const newRuntimeDataModel = String(dist).replace(/config\.runtimeDataModel = JSON\.parse\(".*"\)/, runtimeDataModel);
fs.writeFileSync(destPath, newRuntimeDataModel);
} |
Bug description
Prisma 5.12 client for edge runtime disabled the [Prisma.dmmf] property for wasm client.
for Pothos Graphql client, they need access to [Prisma.dmmf] property to render the graphql.
reference: #22962 (comment)
here is the code in prisma runtime core [defineDmmfProperty].
=> The runtimeDatamodel is already generated for the edge client anyways.
=> you are only disallowing access to this property for wasm/edge. (the datamodel value is generated...just not accessible)
=> please remove the wasm check, and allow the Prisma.dmmf property to be accessed by 3rd party Pothos graphql plugin.
How to reproduce
Expected behavior
you will get error ' Prisma.dmmf is not available when running in edge runtimes.
Prisma information
any prisma schema
Environment & setup
OS: windows 10
Database: [PostgreSQL]
Node.js version: v18.16.0
Prisma Version
prisma 5.12.1
@prisma/client 5.12.1
@prisma/adapter-pg 5.12.1
The text was updated successfully, but these errors were encountered: