Error The "payload" argument must be of type object. Received null

Hello, I keep getting this error with Next.js 15 Postgre SQL and Prisma. I'm confused on if it's a Prisma bug or something else? I'm checking my object before performing any mutation, and it's not null. Anybody know the reason and how to fix it? I've tried rebooting, still nothing
4 Replies
Nurul
Nurul3w ago
Hi @Marvingg 👋 When exactly do you get this error? Once you do a database query or it happens as soon as you start your app? Would you be able to provide a reprodiction so that we can check?
Marvingg
MarvinggOP3w ago
All good, fault was mine. I was comparing the wrong Id in my nested model nested relationship config 🐵
Nurul
Nurul3w ago
I am glad to hear that the issue is resolved 🙌
Anas Badran
Anas Badran2w ago
same issue here, it happens when trying to create a record which has a field value same as a field value in a record in the database which @unique constraint. the error
⨯ uncaughtException: TypeError: The "payload" argument must be of type object. Received null
at frame (node_modules\.pnpm\[email protected][email protected][email protected][email protected]\node_modules\next\src\server\patch-error-inspect.ts:89:42)
at getSourcemappedFrameIfPossible (node_modules\.pnpm\[email protected][email protected][email protected][email protected]\node_modules\next\src\server\patch-error-inspect.ts:179:32)
at parseAndSourceMap (node_modules\.pnpm\[email protected][email protected][email protected][email protected]\node_modules\next\src\server\patch-error-inspect.ts:234:23)
at exit (node_modules\.pnpm\[email protected][email protected][email protected][email protected]\node_modules\next\src\server\patch-error-inspect.ts:224:32)
at apply (webpack://next/dist/compiled/react-server-dom-turbopack/cjs/react-server-dom-turbopack-server.edge.development.js:569:32)
at apply (webpack://next/dist/compiled/react-server-dom-turbopack/cjs/react-server-dom-turbopack-server.node.development.js:593:32)
at console.error (D:\code\developing\next\gohary-archive\.next\server\chunks\ssr\f669a_@mantine_core_esm_74c261._.js:6519:13)
at apply (webpack://next/dist/compiled/react-server-dom-webpack/cjs/react-server-dom-webpack-server.node.development.js:593:32)
at error (node_modules\.pnpm\[email protected][email protected][email protected][email protected]\node_modules\next\src\server\lib\start-server.ts:300:18) {
code: 'ERR_INVALID_ARG_TYPE'
}
⨯ uncaughtException: TypeError: The "payload" argument must be of type object. Received null
at frame (node_modules\.pnpm\[email protected][email protected][email protected][email protected]\node_modules\next\src\server\patch-error-inspect.ts:89:42)
at getSourcemappedFrameIfPossible (node_modules\.pnpm\[email protected][email protected][email protected][email protected]\node_modules\next\src\server\patch-error-inspect.ts:179:32)
at parseAndSourceMap (node_modules\.pnpm\[email protected][email protected][email protected][email protected]\node_modules\next\src\server\patch-error-inspect.ts:234:23)
at exit (node_modules\.pnpm\[email protected][email protected][email protected][email protected]\node_modules\next\src\server\patch-error-inspect.ts:224:32)
at apply (webpack://next/dist/compiled/react-server-dom-turbopack/cjs/react-server-dom-turbopack-server.edge.development.js:569:32)
at apply (webpack://next/dist/compiled/react-server-dom-turbopack/cjs/react-server-dom-turbopack-server.node.development.js:593:32)
at console.error (D:\code\developing\next\gohary-archive\.next\server\chunks\ssr\f669a_@mantine_core_esm_74c261._.js:6519:13)
at apply (webpack://next/dist/compiled/react-server-dom-webpack/cjs/react-server-dom-webpack-server.node.development.js:593:32)
at error (node_modules\.pnpm\[email protected][email protected][email protected][email protected]\node_modules\next\src\server\lib\start-server.ts:300:18) {
code: 'ERR_INVALID_ARG_TYPE'
}
I know this is weird, but the issue happens when there is a console.log in a catch block, if I remove it, the error doesn't appear.
try {
await prisma.post.create({/* data */ })
} catch (e) {
// console.log('I have patched something', e);
console.log(JSON.stringify(e)); // this will not cause any issue
console.log(e); // this is what is causing the issue.
}
try {
await prisma.post.create({/* data */ })
} catch (e) {
// console.log('I have patched something', e);
console.log(JSON.stringify(e)); // this will not cause any issue
console.log(e); // this is what is causing the issue.
}
Want results from more Discord servers?
Add your server