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

Unable to use node-rdkafka when updating Electron >=v28.0.0 due to V8 Engine v12 dependency #1098

Open
uncvrd opened this issue Oct 11, 2024 · 0 comments

Comments

@uncvrd
Copy link

uncvrd commented Oct 11, 2024

Environment Information

  • OS [e.g. Mac, Arch, Windows 10]: Mac, arm64 (M3)
  • Node Version [e.g. 8.2.1]: v18.18.2
  • NPM Version [e.g. 5.4.2]: v9.8.1
  • node-rdkafka version [e.g. 2.3.3]: 3.1.1

Steps to Reproduce

Hi there! I've been working on updating an existing project to a new set of dependencies. We currently use node-rdkafka in an Electron app running Electron v10. In an attempt to update to the version v28, this failed when Electron tries to build native dependencies (like node-rdkafka).

This has to do from an update of Electron that updates the V8 Engine from v11 to v12 and deprecates a function(?) called CopyablePersistentTraits

Here is the output i see:

/Users/lewallen/GitHub/plotter/node_modules/node-rdkafka/src/callbacks.h:45:44: error: no template named 'CopyablePersistentTraits' in namespace 'v8'; did you mean 'Nan::CopyablePersistentTraits'?
   45 |   std::vector<v8::Persistent<v8::Function, v8::CopyablePersistentTraits<v8::Function> > > callbacks;  // NOLINT
      |                                            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
      |                                            Nan::CopyablePersistentTraits
../node_modules/nan/nan.h:208:29: note: 'Nan::CopyablePersistentTraits' declared here

I found something similar for sqlite here that mentions this deprecation

WiseLibs/better-sqlite3#1199 (comment)

When I install Electron v27 it uses V8 engine v11 and the @electron/rebuild build step succeeds but when I try to use Electron v28 it uses V8 engine v12 and it fails.

I am not an expert here, but am I on the right track that this is the culprit? I was wondering what steps would need to be taken to allow support for newer versions of the V8 engine that Electron uses >= v28

I see that this CopyablePerisistentTraits is utilized here:

protected:

Is it as simple as updating the function(?) to just do the following diff?

template <class T> using CopyablePersistent = v8::Persistent<T, v8::CopyablePersistentTraits<T>>;
template <class T> using CopyablePersistent = v8::Global<T>;

I do apologize for my lack of skill here but I'm hoping this can help lead us in the right direction for support of newer versions of Electron.

Really appreciate your time and let me know what else I can do to help.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant