I am trying to get node-rdkafka set up on an application running in Heroku, and every time the application starts I get this error:
Error: librdkafka++.so.1: cannot open shared object file: No such file or
directory
at Object.Module._extensions..node (module.js:681:18)
at Module.load (module.js:565:32)
at tryModuleLoad (module.js:505:12)
at Function.Module._load (module.js:497:3)
at Module.require (module.js:596:17)
at require (internal/module.js:11:18)
at bindings (/app/node_modules/bindings/bindings.js:81:44)
at Object.<anonymous> (/app/node_modules/node-rdkafka/librdkafka.js:10:32)
at Module._compile (module.js:652:30)
at Object.Module._extensions..js (module.js:663:10)
I have the application building and running just fin on my local machine. I know that librdkafka-dev and librdkafka1 are installed on the Ubuntu builds on Heroku by default, but I don't know what else to look at.
You have to use the Confluent librdkafk package.
Add this to your Aptfile:
:repo:deb [arch=amd64] http://packages.confluent.io/deb/4.0 stable main
Still having issues after doing this, but they are different issues and it looks like I'm closer.
I have the same issue with a docker container hosted on linux. I had to revert:
node-rdkafka@^2.2.0:
- version "2.3.1"
- resolved "https://registry.yarnpkg.com/node-rdkafka/-/node-rdkafka-2.3.1.tgz#1c10b85c997243d50a14b09c03ee8f2370df8d56"
+ version "2.2.3"
+ resolved "https://registry.yarnpkg.com/node-rdkafka/-/node-rdkafka-2.2.3.tgz#05d8cafdbaf27bf1e8ef2b8e5bf39afb59a2e701"
dependencies:
librdkafka++.so.1: cannot open shared object file: No such file or directory
I also experienced this when I upgraded. My build ran and then I copied the assets over into the container. If you are able to run the install on the target server (or docker image) it works as it did in previous versions.
Most helpful comment
I have the same issue with a docker container hosted on linux. I had to revert: