postgresql 错误PrismaClientKnownRequestError:无效的`prisma.post.delete()`调用:

bkhjykvo  于 2023-10-18  发布在  PostgreSQL
关注(0)|答案(1)|浏览(156)

这是完整的错误消息

error PrismaClientKnownRequestError: 
Invalid `prisma.post.delete()` invocation:

An operation failed because it depends on one or more records that were required but not found. Record to delete does not exist.
    at wn.handleRequestError (/var/task/node_modules/@prisma/client/runtime/library.js:123:6730)
    at wn.handleAndLogRequestError (/var/task/node_modules/@prisma/client/runtime/library.js:123:6119)
    at wn.request (/var/task/node_modules/@prisma/client/runtime/library.js:123:5839)
    at async l (/var/task/node_modules/@prisma/client/runtime/library.js:128:9763)
    at async DELETE (/var/task/.next/server/app/api/post/[id]/route.js:54:18)
    at async /var/task/.next/server/chunks/501.js:5600:37 {
  code: 'P2025',
  clientVersion: '5.3.1',
  meta: { cause: 'Record to delete does not exist.' }
}

我试图调试一个部署到Vercel的NextJS项目,我遇到了路由处理程序在生产中不工作但在开发中工作良好的问题。每当我以用户身份与它交互时触发这些事件时,就会出现这种错误。比如删除或发布一些东西。错误看起来像是来自棱镜。
我试过Prisma Docs,但似乎没有什么变化。
这是错误屏幕

jum4pzuy

jum4pzuy1#

两天后我终于发现了问题。我不
export const dynamic = 'force-dynamic';
每次访问此页面时,使页面重新呈现从数据库中提取的结果。

相关问题