- 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"
}
}
It seems that your issue is related to this. Currently there's an issue with Node.js version 12.19.0 that Heroku uses and there's a dependency named
undici
that's causing the issue. It should work if you try it with Node 14 in Heroku.