Bug description
TypeError: Do not know how to serialize a BigInt
When making a raw query where a parameter is of type BigInt
How to reproduce
Trying to execute a raw query, where some of the parameters are BigInt:
prisma.$executeRaw`select my_custom_function(${foo_id}, ${bar_id}, ${woo_id})`;
or
prisma.$executeRaw('select my_custom_function($1, $2, $3)', foo_id, bar_id, woo_id);
I get:
TypeError: Do not know how to serialize a BigInt
If i do:
prisma.$executeRaw(`select my_custom_function(${foo_id.toString()}, ${bar_id.toString()}, ${woo_id.toString()})`);
it works just fine.
Expected behavior
It should work just fine.
Prisma information
$ cat package.json
{
"name": "typescript-graphql",
"scripts": {
"start": "ts-node --transpile-only ./src/server",
"dev": "ts-node-dev --no-notify --respawn --transpile-only --watch ./src/schema.graphql ./src/server"
},
"dependencies": {
"@adyen/api-library": "^7.0.0",
"@prisma/client": "^2.17.0",
"@types/jsonwebtoken": "^8.5.0",
"apollo-server": "^2.21.0",
"graphql": "^15.5.0",
"jsonwebtoken": "^8.5.1"
},
"devDependencies": {
"@types/graphql": "^14.5.0",
"@types/node": "^14.14.31",
"@types/ws": "^7.4.0",
"@typescript-eslint/eslint-plugin": "^4.15.1",
"@typescript-eslint/parser": "^4.15.1",
"eslint": "^7.20.0",
"eslint-config-prettier": "^8.0.0",
"eslint-plugin-prettier": "^3.3.1",
"eslint-plugin-simple-import-sort": "^7.0.0",
"prettier": "^2.2.1",
"prisma": "^2.17.0",
"ts-node": "^9.1.1",
"ts-node-dev": "^1.1.1",
"typescript": "^4.1.5"
},
"prettier": {
"singleQuote": true,
"semi": false,
"trailingComma": "es5"
},
"engines": {
"node": ">=10.0.0"
}
}
- PosgreSQL 13
- Ubuntu 18.04
- Node 14
Bug description
When making a raw query where a parameter is of type
BigIntHow to reproduce
Trying to execute a raw query, where some of the parameters are
BigInt:or
I get:
If i do:
it works just fine.
Expected behavior
It should work just fine.
Prisma information