ibm-messaging / mq-mqi-nodejs

Calling IBM MQ from Node.js - a JavaScript MQI wrapper
Apache License 2.0
79 stars 41 forks source link

Facing issue while setting up MQ Redist Client package on API running on Node js 18 version #166

Closed Ajmalshaikh89 closed 4 months ago

Ajmalshaikh89 commented 1 year ago

Please include the following information in your ticket.

Error: ENOENT: no such file or directory, open '/opt/mqm/lib/libmqm_r.so' at Object.openSync (node:fs:599:3) at readFileSync (node:fs:467:35) at new DynamicLibrary (/opt/app/node_modules/ffi-napi/lib/dynamic_library.js:68:23) at Object.Library (/opt/app/node_modules/ffi-napi/lib/library.js:47:10) at loadLib (/opt/app/node_modules/ibmmq/lib/mqi.js:303:18) at loadLibMulti (/opt/app/node_modules/ibmmq/lib/mqi.js:434:13) at Object. (/opt/app/node_modules/ibmmq/lib/mqi.js:455:1) at Module._compile (node:internal/modules/cjs/loader:1119:14) at Module._extensions..js (node:internal/modules/cjs/loader:1173:10) at Module.load (node:internal/modules/cjs/loader:997:32) { errno: -2, syscall: 'open', code: 'ENOENT', path: '/opt/mqm/lib/libmqm_r.so' }

Node.js v18.8.0 Can you assist in letting us know why are getting this. We are running our containers on Debian 10 version. We have already done this setup on another api, but we did not get this error. Seems like Postinstall script at npm install stage is trying to run a script which is not able to complete the MQ Client C location. When we run this in local dev environment, it works fine. Can you please assist. Thanks Ajmal Shaikh

ibmmqmet commented 1 year ago

The error message you are reporting here shows that the MQ client libaries have not been installed on the image.

There's no way to tell from here WHY those client libraries are not installed as you have not included that information.

For linux/x64 systems, the postinstall script will usually try to download the libraries and unpack them. If your system is running in an environment without access to the public download site, or if you are trying to access older versions of the MQ client library that are no longer on the IBM download site, then you will need to manually put the libraries into your container image and disable the postinstall script from trying to execute the download. Set the MQIJS_NOREDIST environment variable to any value.

Ajmalshaikh89 commented 1 year ago

Hi, Thanks for the email. Please find the details of the logs for your reference: here is the log at npm install stage where it downloads mq

ibmmq@https://nexus.iw-bld.oncp.dev/repository/npm-hosted/ibmmq/-/ibmmq-1.0.4.tgz postinstall /home/jenkins/agent/workspace/oredocument-listener-api_develop/node_modules/ibmmq 16:33:18 > node postinstall.js 16:33:18 16:33:19 Downloading IBM MQ Redistributable C Client runtime libraries - version 9.3.0.5 16:33:19 Getting https://nexus.iw-bld.oncp.dev/repository/binaries/mqdev/redist/9.3.0.5-IBM-MQC-Redist-LinuxX64.tar.gz 16:33:19 (node:676) Warning: Setting the NODE_TLS_REJECT_UNAUTHORIZED environment variable to '0' makes TLS connections and HTTPS requests insecure by disabling certificate verification. 16:33:19 (Use node --trace-warnings ... to show where the warning was created) 16:33:19 Unpacking libraries... 16:33:22 Removing 9.3.0.5-IBM-MQC-Redist-LinuxX64.tar.gz 16:33:24 npm WARN The package snyk is included as both a dev and production dependency. 16:33:24 npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@2.3.2 (node_modules/fsevents): 16:33:24 npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@2.3.2: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"}) 16:33:24 16:33:24 added 1550 packages from 809 contributors in 70.764s

Ajmalshaikh89 commented 1 year ago

We have moved the RD client library to Nexus so that we can download the file from that location to Dockerfile. However, even after it has worked in other setup, it is giving us error for this setup.

chughts commented 1 year ago

This looks like npm doesn't like the certificate on nexus.iw-bld.oncp.dev

As the warning log hints you should be able work around by setting the environment variable NODE_TLS_REJECT_UNAUTHORIZED to 0

ibmmqmet commented 1 year ago

That also looks like you might have edited the postinstall script to download from your own site. (The 1.0.4 version didn't allow custom URLs.) If you are running the postinstall directly instead of as part of the full npm install process, then perhaps you're not running it in the right directory. Running the app with the environment variable MQIS_TRACE ought to show where the code is trying to load libmqm from. And then you can check it's correctly installed.