TypeError: The "payload" argument must be of type object. Received null
There's an ongoing issue in our codebase where Prisma queries that fail give the error in the title, which isn't the typical error we see in other projects. Our project is using NextJS 15.0.2 and Prisma (with neon serverless adapter) 5.22.0.
Here is the client:
import { Pool } from "@neondatabase/serverless";
import { PrismaNeon } from "@prisma/adapter-neon";
import { PrismaClient } from "@prisma/client";
const globalForPrisma = global as unknown as { prisma: PrismaClient };
function makeClient() {
const neon = new Pool({ connectionString: process.env.DATABASE_URL });
const adapter = new PrismaNeon(neon);
return new PrismaClient({ adapter });
}
const db = globalForPrisma.prisma || makeClient();
if (process.env.NODE_ENV === "development") {
globalForPrisma.prisma = db;
}
export default db;
8 Replies
Hi @яσчαℓтℓя
Can you please enable detailed debugging and share the relevant logs?
https://www.prisma.io/docs/orm/prisma-client/debugging-and-troubleshooting/debugging
Debugging (Reference) | Prisma Documentation
This page explains how to enable debugging output for Prisma Client by setting the
DEBUG
environment variable.Getting the exact same thing
Relevant API
route.ts
:
Note the object is being created in database, however it doesn't seem to want to return back to the client after request.@Zeke What do you get for show variable when you log it?
Can you add this line
before
Let me know the result
I think this is an issue with neon serverless integration but I may be wrong
We initially thought it might be NextJS 15 but we have multiple projects in NextJS 15 which show the verbose error message, but the project with neon serverless adapter shows the payload null error
Hi. Thanks for the reply
I have switched over to using a server action implementation
Here is the relevant section of my new
Actions.ts
:
And, upon catching an error in that query, I get this:
Here is my schema.prisma
:
I can confirm all the relevant variables are correct. In any other query I run, for example, creating hosts, creating shows, deleting shows, you name it - Anything where a 'create', 'update', or 'delete', is going down - This error occurs.
I AM using Turso!
Maybe there is something not supported?
Here is my prisma.ts
:
Interestingly, when removing everything after $extends... It is fixed... May be a Turso issue. No clue.,I'm not sure if it's "only" Next.js 15 issue but on my project I just downgraded to Next.js 14 without making any other change and the error now displays correctly. With Next.js 15 I get the generic "payload argument" error.
It seems it only happens with Next.js 15 and some combination of transpiling or client extensions.