47ng / 47ng/prisma-field-encryption
Prisma 6.16.0 — `dmmf` shape changed: `documentation` missing and field-encryption breaks in `prisma-client-js`
- Dominant language
- TypeScript
- Stars
- 306
- Forks
- 40
- PR merge metrics
- No merged PRs in 30d
Description
Starting with Prisma **v6.16.0**, Prisma appears to have removed its Rust dependency.
Reference: [https://github.com/prisma/prisma/releases/tag/6.16.0](https://github.com/prisma/prisma/releases/tag/6.16.0)
After upgrading, the shape of `dmmf` returned by the new client seems to have changed. As a result:
* Zod validation fails because `isList`, `isUnique`, and `isId` are no longer present on fields.
* `documentation` also appears to be missing or no longer accessible via `dmmf`.
I patched the package to avoid the Zod errors, but I still cannot load `documentation`. Because of this, field encryption no longer works.
This problem occurs when using **`prisma-client-js`** (not `prisma-client`). `prisma-client` recommends using `@prisma/internals` as a workaround, but including `@prisma/internals` pulls a WASM file into the package and that causes errors in some web frameworks (bundling/runtime issues).
## Steps to reproduce
1. Upgrade Prisma to `6.16.0` (or later).
2. Generate the client and inspect `dmmf` from `prisma-client-js`.
3. Attempt to read `field.documentation` (or run code that expects `isList`, `isUnique`, `isId`).
4. Observe Zod validation / field-encryption code failing and `documentation` being unavailable.
## Actual behavior
* `dmmf` no longer contains `isList`, `isUnique`, or `isId` for fields.
* `documentation` is not accessible via `dmmf`.
* Workarounds that import `@prisma/internals` introduce WASM which breaks bundling/runtime in some web frameworks.
* Field encryption fails because it cannot determine which fields have documentation/metadata.
## Workarounds tried
* Rewrote the package to bypass the missing `isList`/`isUnique`/`isId` checks — still cannot access `documentation`.
* Using `@prisma/internals` (suggested by `prisma-client`) — this causes errors in some web frameworks due to the WASM file being included.
## Example
dmmf
```json
{
"datamodel":{
"models":[
{
"name":"User",
"fields":[
{
"name":"id",
"kind":"scalar",
"type":"String"
},
{
"name":"name",
"kind":"scalar",
"type":"String"
},
{
"name":"email",
"kind":"scalar",
"type":"String"
},
{
"name":"emailVerified",
"kind":"scalar",
"type":"Boolean"
},
{
"name":"image",
"kind":"scalar",
"type":"String"
},
{
"name":"role",
"kind":"scalar",
"type":"String"
},
{
"name":"banned",
"kind":"scalar",
"type":"Boolean"
},
{
"name":"banReason",
"kind":"scalar",
"type":"String"
},
{
"name":"banExpires",
"kind":"scalar",
"type":"DateTime"
},
{
"name":"stripeCustomerId",
"kind":"scalar",
"type":"String"
},
{
"name":"chatwootSourceId",
"kind":"scalar",
"type":"String"
},
{
"name":"createdAt",
"kind":"scalar",
"type":"DateTime"
},
{
"name":"updatedAt",
"kind":"scalar",
"type":"DateTime"
}
]
}
]
}
}
```
schema.prisma
```prisma
model User {
id String @id
name String
email String @unique
emailVerified Boolean
image String?
role String?
banned Boolean?
banReason String?
banExpires DateTime?
stripeCustomerId String?
chatwootSourceId String?
createdAt DateTime
updatedAt DateTime
}
```
Contributor guide
Assessment
This issue has not been assessed yet.