Uploaded image for project: 'Node.js Driver'
  1. Node.js Driver
  2. NODE-6122

Fix failing Node tasks using Node 20

    • Type: Icon: Build Failure Build Failure
    • Resolution: Duplicate
    • Priority: Icon: Unknown Unknown
    • None
    • Affects Version/s: None
    • Component/s: Field Level Encryption
    • Labels:
      None
    • Not Needed
    • Hide

      1. What would you like to communicate to the user about this feature?
      2. Would you like the user to see examples of the syntax and/or executable code and its output?
      3. Which versions of the driver/connector does this apply to?

      Show
      1. What would you like to communicate to the user about this feature? 2. Would you like the user to see examples of the syntax and/or executable code and its output? 3. Which versions of the driver/connector does this apply to?

      The build-and-test-node tasks started failing on Ubuntu 20.04 with Node 20.12.0. Example:

      [2024/04/01 14:32:42.404] gyp info spawn args ]
      [2024/04/01 14:32:42.580] > mongodb-client-encryption@6.0.0 rebuild
      [2024/04/01 14:32:42.580] > prebuild --compile
      [2024/04/01 14:32:42.580] make: Entering directory '/data/mci/c0372a7867393b9d3047a9c3867eb17e/libmongocrypt/bindings/node/build'
      [2024/04/01 14:32:43.279] gyp info spawn make
      [2024/04/01 14:32:43.279] gyp info spawn args [ 'BUILDTYPE=Release', '-C', 'build' ]
      [2024/04/01 14:32:43.279] In file included from ../node_modules/node-addon-api/napi.h:2981,
      [2024/04/01 14:32:43.279]                  from ../addon/mongocrypt.h:11,
      [2024/04/01 14:32:43.279]                  from ../addon/mongocrypt.cc:1:
      [2024/04/01 14:32:43.279] ../node_modules/node-addon-api/napi-inl.h: In instantiation of 'Napi::ObjectWrap<T>::ObjectWrap(const Napi::CallbackInfo&) [with T = node_mongocrypt::MongoCrypt]':
      [2024/04/01 14:32:43.279] ../addon/mongocrypt.cc:431:54:   required from here
      [2024/04/01 14:32:43.279] ../node_modules/node-addon-api/napi-inl.h:4114:21: error: invalid conversion from 'void (*)(napi_env, void*, void*)' {aka 'void (*)(napi_env__*, void*, void*)'} to 'node_api_nogc_finalize' {aka 'void (*)(const napi_env__*, void*, void*)'} [-fpermissive]
      [2024/04/01 14:32:43.279]  4114 |   status = napi_wrap(env, wrapper, instance, FinalizeCallback, nullptr, &ref);
      [2024/04/01 14:32:43.279]       |            ~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      [2024/04/01 14:32:43.279]       |                     |
      [2024/04/01 14:32:43.279]       |                     void (*)(napi_env, void*, void*) {aka void (*)(napi_env__*, void*, void*)}
      [2024/04/01 14:32:43.279] In file included from /data/mci/c0372a7867393b9d3047a9c3867eb17e/tmp/prebuild/node/20.12.0/include/node/node_api.h:12,
      [2024/04/01 14:32:43.279]                  from ../node_modules/node-addon-api/napi.h:4,
      [2024/04/01 14:32:43.279]                  from ../addon/mongocrypt.h:11,
      [2024/04/01 14:32:43.279]                  from ../addon/mongocrypt.cc:1:
      [2024/04/01 14:32:43.279] /data/mci/c0372a7867393b9d3047a9c3867eb17e/tmp/prebuild/node/20.12.0/include/node/js_native_api.h:324:69: note:   initializing argument 4 of 'napi_status napi_wrap(napi_env, napi_value, void*, node_api_nogc_finalize, void*, napi_ref__**)'
      [2024/04/01 14:32:43.279]   324 |                                              node_api_nogc_finalize finalize_cb,
      [2024/04/01 14:32:43.279]       |                                              ~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~
      [2024/04/01 14:32:43.286] In file included from ../node_modules/node-addon-api/napi.h:2981,
      [2024/04/01 14:32:43.286]                  from ../addon/mongocrypt.h:11,
      [2024/04/01 14:32:43.286]                  from ../addon/mongocrypt.cc:1:
      [2024/04/01 14:32:43.286] ../node_modules/node-addon-api/napi-inl.h: In instantiation of 'Napi::ObjectWrap<T>::ObjectWrap(const Napi::CallbackInfo&) [with T = node_mongocrypt::MongoCryptContext]':
      [2024/04/01 14:32:43.286] ../addon/mongocrypt.cc:800:81:   required from here
      

      I expect this is related to the NodeJS v20.12.0 release: https://github.com/nodejs/node/blob/main/doc/changelogs/CHANGELOG_V20.md#20.12.0.

      This task was executed twice. The first execution succeeded, and the second execution failed.

      Execution 1 logs:

      [2024/03/26 10:37:53.556] Node.js v20.11.1 for linux-x64 released on 2024-02-13
      

      Execution 2 logs:

      [2024/04/02 12:37:33.954] Node.js v20.12.0 for linux-x64 released on 2024-03-26
      

            Assignee:
            Unassigned Unassigned
            Reporter:
            kevin.albertson@mongodb.com Kevin Albertson
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: