I think there is a double JSON.parse both done by prisma and the adapter.
Using a turborepo with next v16 and Turbopack.
Packages:
"@prisma/client": "6.17.0"
"prisma": "6.17.0",
"@tidbcloud/prisma-adapter": "^6.17.0",
"@tidbcloud/serverless": "^0.2.0",
Client config:
generator client {
provider = "prisma-client"
output = "../generated/client"
engineType = "client"
}
Database package:
import { PrismaTiDBCloud } from '@tidbcloud/prisma-adapter';
import { PrismaClient } from './generated/client/client';
export * from './generated/client/browser';
export type { Booking, Customer, Payment } from './generated/client/client';
export * from './generated/client/enums';
const globalForPrisma = globalThis as { prisma?: PrismaClient };
const adapter = new PrismaTiDBCloud({ url: `${process.env.DATABASE_URL}` }) as any;
export const prisma =
globalForPrisma.prisma ||
new PrismaClient({
log: process.env.NODE_ENV === 'development' ? ['query', 'error', 'warn'] : ['error'],
adapter,
});
if (process.env.NODE_ENV !== 'production') globalForPrisma.prisma = prisma;
Query usage: ("accomodation" is a Json type field)
await prisma.booking.findFirst({
select: { accomodation: true },
where: { publicId: '_oUbnAZN2McwE_EJuXbOL' },
});
Error:
prisma:error "[object Object]" is not valid JSON
⨯ SyntaxError: "[object Object]" is not valid JSON
at JSON.parse (<anonymous>)
I think there is a double JSON.parse both done by prisma and the adapter.
Using a turborepo with next v16 and Turbopack.
Packages:
Client config:
Database package:
Query usage: ("accomodation" is a Json type field)
Error: