错误断言 `args[3]->IsInt32()' 失败

Error Assertion `args[3]->IsInt32()' failed

哪些步骤会重现错误?

我尝试按照 Adding a Database to GraphQL 的教程进行操作,这是我 script.ts:

的代码
const { PrismaClient } = require("@prisma/client")

const prisma = new PrismaClient()

async function main() {
  const allLinks = await prisma.link.findMany()
  console.log(allLinks)
}

main()
  .catch(e => {
    throw e
  })
  .finally(async () => {
    await prisma.disconnect()
  })

它的繁殖频率是多少?有条件吗?

每次我 运行 它使用 node src/script.tsts-node src/script.ts 时。

要求:

预期的行为是什么?

使用 prisma 客户端显示数据库中的所有链接。

你看到了什么?

我尝试使用 node src/script.tsts-node src/script.ts 运行 script.ts,但显示以下错误:

/usr/bin/node[20367]: ../src/node_http_parser_impl.h:529:static void node::{anonymous}::Parser::Initialize(const v8::FunctionCallbackInfo<v8::Value>&): Assertion `args[3]->IsInt32()' failed.
 1: 0xa17c40 node::Abort() [/usr/bin/node]
 2: 0xa17cbe  [/usr/bin/node]
 3: 0xa3214a  [/usr/bin/node]
 4: 0xc019e9  [/usr/bin/node]
 5: 0xc037d7 v8::internal::Builtin_HandleApiCall(int, unsigned long*, v8::internal::Isolate*) [/usr/bin/node]
 6: 0x1409319  [/usr/bin/node]

附加信息

这是我的 package.json 文件:

{
  "name": "learn",
  "version": "1.0.0",
  "description": "A GraphQL Server from scratch for learning purpose.",
  "main": "index.ts",
  "scripts": {
    "start": "dotenv -- nodemon -e ts,graphql -x ts-node src/index.ts",
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "keywords": [],
  "dependencies": {
    "graphql-yoga": "^1.18.3"
  },
  "devDependencies": {
    "@prisma/cli": "^2.8.1",
    "@prisma/client": "^2.8.1",
    "@types/node": "^14.11.2",
    "dotenv-cli": "^4.0.0",
    "nodemon": "^2.0.4",
    "ts-node": "^9.0.0",
    "typescript": "^4.0.3"
  }
}

您的问题似乎与 this 有关。当前,Heroku 使用的 Node.js 版本 12.19.0 存在问题,并且有一个名为 undici 的依赖项导致了该问题。如果您在 Heroku 中使用 Node 14 进行尝试,它应该可以工作。