Repository navigation
Description
Bug description
The @prisma/adapter-mariadb package fails to properly handle JSON fields when querying MariaDB databases. When attempting to retrieve data from a table with a JSON column, the adapter incorrectly serializes the JSON data, resulting in a SyntaxError: "[object Object] is not valid JSON".
Severity
Reproduction
Reproduction with Docker:
https://github.com/BGSchaap/prisma-adapter-mariadb-json
Steps for reproduction can be found in the README.
Includes a working example for MySQL and a bug-reproducing example for MariaDB.
Expected vs. Actual Behavior
Expected Behavior:
The MariaDB adapter should handle JSON fields for both MySQL and MariaDB databases
Actual Behavior:
When attempting to retrieve data from a table with a JSON column, the adapter incorrectly serializes the JSON data, resulting in a SyntaxError:
SyntaxError: "[object Object]" is not valid JSON
at JSON.parse (<anonymous>)
at deserializeTaggedValue (/usr/src/app/node_modules/@prisma/client-engine-runtime/src/json-protocol.ts:154:19)
at mapper (/usr/src/app/node_modules/@prisma/client-engine-runtime/src/json-protocol.ts:127:14)
at mapObjectValues (/usr/src/app/node_modules/@prisma/client-engine-runtime/src/json-protocol.ts:110:19)
at deserializeJsonResponse (/usr/src/app/node_modules/@prisma/client-engine-runtime/src/json-protocol.ts:135:12)
at pi.unpack (/usr/src/app/node_modules/@prisma/client/src/runtime/RequestHandler.ts:277:12)
at pi.mapQueryEngineResult (/usr/src/app/node_modules/@prisma/client/src/runtime/RequestHandler.ts:161:25)
at Object.singleLoader (/usr/src/app/node_modules/@prisma/client/src/runtime/RequestHandler.ts:118:21)
at processTicksAndRejections (node:internal/process/task_queues:105:5)
at async pi.request (/usr/src/app/node_modules/@prisma/client/src/runtime/RequestHandler.ts:140:14) {
clientVersion: '6.16.2'
}
Frequency
Consistently reproducible
Does this occur in development or production?
Both development and production
Is this a regression?
JSON fields in MarieDB databases work with the old Rust client.
Workaround
No workaround found
Prisma Schema & Queries
generator client {
provider = "prisma-client"
engineType = "client"
output = "../src/generated/prisma"
}
datasource db {
provider = "mysql"
url = env("DATABASE_URL")
}
model Table {
id Int @id @default(autoincrement())
json Json?
}const prisma = new PrismaClient({
adapter: new PrismaMariaDb(process.env.DATABASE_URL!),
});
await prisma.table.create({
data: {
json: { name: "John Doe" },
},
});Prisma Config
import { defineConfig } from 'prisma/config';
export default defineConfig({
migrations: {
seed: 'ts-node --project tsconfig.json -r tsconfig-paths/register prisma/seed.ts',
},
});Logs & Debug Info
Bug happens in application after successful query
Environment & Setup
- OS: Debian
- Database: MariaDB
- Node.js version: v22.14.0
Prisma Version
prisma : 6.16.2
@prisma/client : 6.16.2
Computed binaryTarget : debian-openssl-3.0.x
Operating System : linux
Architecture : x64
Node.js : v22.14.0
TypeScript : 5.9.2
Query Engine (Node-API) : libquery-engine 1c57fdcd7e44b29b9313256c76699e91c3ac3c43 (at node_modules/@prisma/engines/libquery_engine-debian-openssl-3.0.x.so.node)
PSL : @prisma/prisma-schema-wasm 6.16.0-7.1c57fdcd7e44b29b9313256c76699e91c3ac3c43
Schema Engine : schema-engine-cli 1c57fdcd7e44b29b9313256c76699e91c3ac3c43 (at node_modules/@prisma/engines/schema-engine-debian-openssl-3.0.x)
Default Engines Hash : 1c57fdcd7e44b29b9313256c76699e91c3ac3c43
Studio : 0.511.0```
Activity
FGoessler commentedon Sep 29, 2025
Thanks for reporting this with all the details. Am closing this as likely duplicate of #28143