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

Created on 10 Oct 2020  Â·  9Comments  Â·  Source: nodejs/node

  • Version: v12.19.0
  • Platform: Linux ayungavis 5.4.0-48-generic #52~18.04.1-Ubuntu SMP Thu Sep 10 12:50:22 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux
  • Subsystem:

What steps will reproduce the bug?

I tried to follow the tutorial from Adding a Database to GraphQL, this is the code of my 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()
  })

How often does it reproduce? Is there a required condition?

Everytime when I run it using node src/script.ts or ts-node src/script.ts.

The requirements:

  • @prisma/cli
  • @prisma/client

What is the expected behavior?

Show all links from the database using prisma client.

What do you see instead?

I tried to run the script.ts using node src/script.ts and ts-node src/script.ts but show the following error:

/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]

Additional information

This is my package.json file:

{
  "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"
  }
}
duplicate wrong repo

Most helpful comment

I think the root cause is following backport PR: https://github.com/nodejs/node/pull/34131 which changes the API of the HTTPParser. The API is internal but it looks like it's used by some modules and they pass more then the expected number of arguments which is no longer ignored.

See also https://github.com/prisma/prisma-client-js/issues/907 and https://github.com/nodejs/undici/issues/448

All 9 comments

I'm with the same issue.

cc @nodejs/http @nodejs/llnode

@devsnek unavailable...

Maybe a dup of #35572?

I think the root cause is following backport PR: https://github.com/nodejs/node/pull/34131 which changes the API of the HTTPParser. The API is internal but it looks like it's used by some modules and they pass more then the expected number of arguments which is no longer ignored.

See also https://github.com/prisma/prisma-client-js/issues/907 and https://github.com/nodejs/undici/issues/448

https://github.com/nodejs/undici/blob/master/lib/node/http-parser.js#L3-L4 — caused by using the internal API directly.
Usage of that API should be fixed in [email protected]: https://github.com/nodejs/undici/issues/448#issuecomment-706070229

Could you confirm that resolving undici to 2.0.7 helps?

For now I'm downgrading my node version to v12.18.4 until the bug is fixed. It's work properly when you use node v12.18.4.
Thank you all about the replies, hopefully it will be fixed soon.

From the available information, it doesn't look like a bug in Node.js.
Let's close this as a duplicate of #35572, as it's unlikely that any new information will be present here.
I'll reopen if there will be any new info hinting that's not the case.

It was confirmed in #35572 that using a fixed version of undici helps.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

jonathanong picture jonathanong  Â·  91Comments

VanCoding picture VanCoding  Â·  204Comments

yury-s picture yury-s  Â·  89Comments

addaleax picture addaleax  Â·  146Comments

mikeal picture mikeal  Â·  90Comments