Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
ayungavis opened this issue Oct 10, 2020 · 10 comments
Closed

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

ayungavis opened this issue Oct 10, 2020 · 10 comments
Labels
duplicate Issues and PRs that are duplicates of other issues or PRs. wrong repo Issues that should be opened in another repository.

Comments

@ayungavis
Copy link

ayungavis commented Oct 10, 2020

  • Version: v12.19.0
  • Platform: Linux ayungavis 5.4.0-48-generic io.js on The Changelog! #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"
  }
}
@andredezzy
Copy link

I'm with the same issue.

@devsnek
Copy link
Member

devsnek commented Oct 10, 2020

cc @nodejs/http @nodejs/llnode

@andredezzy
Copy link

@devsnek unavailable...

@Flarna
Copy link
Member

Flarna commented Oct 10, 2020

Maybe a dup of #35572?

@Flarna
Copy link
Member

Flarna commented Oct 10, 2020

I think the root cause is following backport PR: #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 prisma/prisma-client-js#907 and nodejs/undici#448

@ChALkeR
Copy link
Member

ChALkeR commented Oct 11, 2020

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 undici@2.0.7: nodejs/undici#448 (comment)

Could you confirm that resolving undici to 2.0.7 helps?

@ayungavis
Copy link
Author

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.

@ChALkeR
Copy link
Member

ChALkeR commented Oct 11, 2020

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.

@ChALkeR ChALkeR closed this as completed Oct 11, 2020
@ChALkeR ChALkeR added the duplicate Issues and PRs that are duplicates of other issues or PRs. label Oct 11, 2020
@ChALkeR
Copy link
Member

ChALkeR commented Oct 12, 2020

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

@maguri
Copy link

maguri commented Dec 2, 2021

Prisma Issue

  • nodejs 16.13.1
  • @prisma/client ^2.13.1
  • Windows 10

For me it was a problem after upgrade to node 16.13.1
Now I use nvm for Windows, and with node 14.8.0 it works again.

The problem is when you start and generate all the prisma schema with some version and then you change it.

If you want to keep your node updated you probably need to prisma generate all again

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
duplicate Issues and PRs that are duplicates of other issues or PRs. wrong repo Issues that should be opened in another repository.
Projects
None yet
Development

No branches or pull requests

6 participants