Skip to content

BGSchaap/prisma-adapter-mariadb-json

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 

Repository files navigation

Minimal working example of bug in @prisma/adapter-mariadb

When using @prisma/adapter-mariadb package in combination with JSON fields, the adapter does not properly handle the JSON data for MariaDB databases. This example demonstrates the bug and provides a verification that the bug is not present for MySQL databases.

Setup

docker compose build
docker compose run --rm backend yarn install

Working example with MySQL

docker compose up -d mysql
docker compose run --rm backend-mysql yarn db:migrate
docker compose run --rm backend-mysql yarn db:seed

Buggy example with MariaDB

docker compose up -d mariadb
docker compose run --rm backend-mariadb yarn db:migrate
docker compose run --rm backend-mariadb yarn db:seed

Stack trace

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'
}

About

Minimal working example for bug concerning JSON fields in MariaDB

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors