Prisma-client-js: Prisma and node 12.19.0

Created on 7 Oct 2020  路  8Comments  路  Source: prisma/prisma-client-js

Bug description

Prisma (latest dev, 2.8.0, 2.8.1, 2.7.0 versions) with node 12.19.0 results in the following error:

2020-10-07T12:57:03.018176+00:00 app[web.1]: node[4]: ../src/node_http_parser_impl.h:529:static void node::{anonymous}::Parser::Initialize(const v8::FunctionCallbackInfo<v8::Value>&): Assertion `args[3]->IsInt32()' failed.
2020-10-07T12:57:03.023285+00:00 app[web.1]: 1: 0xa17c40 node::Abort() [node]
2020-10-07T12:57:03.024000+00:00 app[web.1]: 2: 0xa17cbe  [node]
2020-10-07T12:57:03.024670+00:00 app[web.1]: 3: 0xa3214a  [node]
2020-10-07T12:57:03.025326+00:00 app[web.1]: 4: 0xc019e9  [node]
2020-10-07T12:57:03.027280+00:00 app[web.1]: 5: 0xc037d7 v8::internal::Builtin_HandleApiCall(int, unsigned long*, v8::internal::Isolate*) [node]

How to reproduce

  1. git clone https://github.com/divyenduz/prisma-client-js-907 p2-node-12
  2. cd p2-node-12
  3. Setup node 12.19.0 in the environment
  4. Add Postgres DB_URL to prisma/.env (ping Divy, if needed)
  5. node index.js
  6. Invoke the URL (http://localhost:3000), it should fail

The error mentioned above should be visible in the logs.

Expected behavior

Prisma and node 12.19.0 should work.

bu2-confirmed kinbug tectypescript

Most helpful comment

Looks like node 12.19.0 broke something here. We are able to reproduce this locally with node version v12.19.0 while it is working fine with node version 12.18.4.

image

We will need to report this to node.js I think.

馃殌 Server ready at: http://localhost:3000
猸愶笍 See sample requests: http://pris.ly/e/ts/rest-express#3-using-the-rest-api
node[17950]: ../src/node_http_parser_impl.h:529:static void node::(anonymous namespace)::Parser::Initialize(const FunctionCallbackInfo<v8::Value> &): Assertion `args[3]->IsInt32()' failed.
 1: 0x1011f40c5 node::Abort() (.cold.1) [/Users/harshit/.nvm/versions/node/v12.19.0/bin/node]
 2: 0x1000a5749 node::Abort() [/Users/harshit/.nvm/versions/node/v12.19.0/bin/node]
 3: 0x1000a55b1 node::Assert(node::AssertionInfo const&) [/Users/harshit/.nvm/versions/node/v12.19.0/bin/node]
 4: 0x1000c6e1b node::(anonymous namespace)::Parser::Initialize(v8::FunctionCallbackInfo<v8::Value> const&) [/Users/harshit/.nvm/versions/node/v12.19.0/bin/node]
 5: 0x100259838 v8::internal::FunctionCallbackArguments::Call(v8::internal::CallHandlerInfo) [/Users/harshit/.nvm/versions/node/v12.19.0/bin/node]
 6: 0x100258df9 v8::internal::MaybeHandle<v8::internal::Object> v8::internal::(anonymous namespace)::HandleApiCallHelper<false>(v8::internal::Isolate*, v8::internal::Handle<v8::internal::HeapObject>, v8::internal::Handle<v8::internal::HeapObject>, v8::internal::Handle<v8::internal::FunctionTemplateInfo>, v8::internal::Handle<v8::internal::Object>, v8::internal::BuiltinArguments) [/Users/harshit/.nvm/versions/node/v12.19.0/bin/node]
 7: 0x100258562 v8::internal::Builtin_Impl_HandleApiCall(v8::internal::BuiltinArguments, v8::internal::Isolate*) [/Users/harshit/.nvm/versions/node/v12.19.0/bin/node]
 8: 0x100a02b19 Builtins_CEntry_Return1_DontSaveFPRegs_ArgvOnStack_BuiltinExit [/Users/harshit/.nvm/versions/node/v12.19.0/bin/node]
 9: 0x1009882a4 Builtins_InterpreterEntryTrampoline [/Users/harshit/.nvm/versions/node/v12.19.0/bin/node]
[1]    17950 abort      node src/index.js

All 8 comments

From my findings, looks like 12.x node runtime of heroku is not working with prisma. It is most likely because some module in the dependency chain is using process.binding to use the http parser which node internally uses.

When I use 14.x runtime it works which is the current node lts release. Also, I tried an older version of prisma 2.6 which also fails in heroku 12.x so this is clearly not a regression in prisma.

Looks like node 12.19.0 broke something here. We are able to reproduce this locally with node version v12.19.0 while it is working fine with node version 12.18.4.

image

We will need to report this to node.js I think.

馃殌 Server ready at: http://localhost:3000
猸愶笍 See sample requests: http://pris.ly/e/ts/rest-express#3-using-the-rest-api
node[17950]: ../src/node_http_parser_impl.h:529:static void node::(anonymous namespace)::Parser::Initialize(const FunctionCallbackInfo<v8::Value> &): Assertion `args[3]->IsInt32()' failed.
 1: 0x1011f40c5 node::Abort() (.cold.1) [/Users/harshit/.nvm/versions/node/v12.19.0/bin/node]
 2: 0x1000a5749 node::Abort() [/Users/harshit/.nvm/versions/node/v12.19.0/bin/node]
 3: 0x1000a55b1 node::Assert(node::AssertionInfo const&) [/Users/harshit/.nvm/versions/node/v12.19.0/bin/node]
 4: 0x1000c6e1b node::(anonymous namespace)::Parser::Initialize(v8::FunctionCallbackInfo<v8::Value> const&) [/Users/harshit/.nvm/versions/node/v12.19.0/bin/node]
 5: 0x100259838 v8::internal::FunctionCallbackArguments::Call(v8::internal::CallHandlerInfo) [/Users/harshit/.nvm/versions/node/v12.19.0/bin/node]
 6: 0x100258df9 v8::internal::MaybeHandle<v8::internal::Object> v8::internal::(anonymous namespace)::HandleApiCallHelper<false>(v8::internal::Isolate*, v8::internal::Handle<v8::internal::HeapObject>, v8::internal::Handle<v8::internal::HeapObject>, v8::internal::Handle<v8::internal::FunctionTemplateInfo>, v8::internal::Handle<v8::internal::Object>, v8::internal::BuiltinArguments) [/Users/harshit/.nvm/versions/node/v12.19.0/bin/node]
 7: 0x100258562 v8::internal::Builtin_Impl_HandleApiCall(v8::internal::BuiltinArguments, v8::internal::Isolate*) [/Users/harshit/.nvm/versions/node/v12.19.0/bin/node]
 8: 0x100a02b19 Builtins_CEntry_Return1_DontSaveFPRegs_ArgvOnStack_BuiltinExit [/Users/harshit/.nvm/versions/node/v12.19.0/bin/node]
 9: 0x1009882a4 Builtins_InterpreterEntryTrampoline [/Users/harshit/.nvm/versions/node/v12.19.0/bin/node]
[1]    17950 abort      node src/index.js

Fixed in dev version @prisma/[email protected] in this PR (I recommend to only use latest tag from npm for production though).

If you want to use Prisma 2.8 and older you can pin your Node.js version to a previous version of Node (<12.9.0)

Current workaround until a fix is found and released in next Prisma release is to pin your Node.js version to a previous version of Node (<12.9.0).

Undici 2.0.7 was released with the fix from this PR https://github.com/nodejs/undici/pull/449

I updated the dependency with https://github.com/prisma/prisma/pull/3884

It's now in 2.9.0-dev.66 (We recommend to only use latest tag from npm for production, not dev).

Next step: confirm the fix @divyenduz

Here is an example on how to pin a Node.js dependency for Netlify and Vercel, thanks to @thedavidprice https://github.com/redwoodjs/redwood/issues/1313#issuecomment-706443974

Workaround

Pin the version of NodeJS used for Netlify and Vercel build in your .nvmrc file:

  • Replace
// .nvmrc

lts/*
  • with
// .nvmrc

v12.18.4

The fix was confirmed with https://github.com/prisma/e2e-tests/pull/834

It will be part of the 2.9.0 release tomorrow 馃殌

Was this page helpful?
0 / 5 - 0 ratings

Related issues

julien1619 picture julien1619  路  3Comments

FluorescentHallucinogen picture FluorescentHallucinogen  路  3Comments

esistgut picture esistgut  路  4Comments

maartenraes picture maartenraes  路  4Comments

AhmedElywa picture AhmedElywa  路  4Comments