bwgjoseph / mongoose-vs-ottoman

feature comparison between mongoose and ottoman
0 stars 1 forks source link

unknown error installing couchbase package on offline environment #93

Closed bwgjoseph closed 3 years ago

bwgjoseph commented 3 years ago

Hi,

While trying to install couchbase package on the offline environment, I encountered some error where it seems that couchbase is trying to connect to the internet to install some additional stuff?

This is the complete error log

bwgjoseph@OR-GBOONWE MINGW64 ~/Desktop/feathers-ottoman-demo (main)
$ npm i

> couchbase@3.1.1 install C:\Users\bwgjoseph\Desktop\feathers-ottoman-demo\node_modules\couchbase
> prebuild-install || node-gyp rebuild

prebuild-install WARN install getaddrinfo EAI_AGAIN github.com

C:\Users\bwgjoseph\Desktop\feathers-ottoman-demo\node_modules\couchbase>if not defined npm_config_node_gyp (node "C:\Users\bwgjoseph\AppData\Roaming\npm\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js" rebuild )  else (node "C:\Users\bwgjoseph\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js" rebuild )
gyp WARN install got an error, rolling back install
gyp ERR! configure error
gyp ERR! stack Error: getaddrinfo EAI_AGAIN nodejs.org
gyp ERR! stack     at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:67:26)
gyp ERR! System Windows_NT 10.0.17763
gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\bwgjoseph\\AppData\\Roaming\\npm\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"
gyp ERR! cwd C:\Users\bwgjoseph\Desktop\feathers-ottoman-demo\node_modules\couchbase
gyp ERR! node -v v14.16.0
gyp ERR! node-gyp -v v5.1.0
gyp ERR! not ok
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@~2.3.1 (node_modules\chokidar\node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@2.3.2: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! couchbase@3.1.1 install: `prebuild-install || node-gyp rebuild`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the couchbase@3.1.1 install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\bwgjoseph\AppData\Roaming\npm-cache\_logs\2021-06-04T12_03_05_649Z-debug.log

Do help to figure this out asap as this prevents from working in an offline environment entirely.

Thank you!

AV25242 commented 3 years ago

Sure will pass it out to the team

bwgjoseph commented 3 years ago

Just some additional information, I have a private repository hosted in the offline environment, so installing dependencies in an offline environment is not the problem.

Installing couchbase is different as it seem to be doing or pre/post installation stuff but not sure what it is

AV25242 commented 3 years ago

hello @bwgjoseph got his response from our Developers You need to either have access to the internet in order to download our prebuilt binaries. Or you need to have node-gyp installed so that it can be built locally at install time

httpJunkie commented 3 years ago

We use native binary You can build it on your system using node gyp and not download anything externally: https://github.com/nodejs/node-gyp/issues/665

Or you can setup a prebuilt server and point your prebuild to that server: https://github.com/prebuild/prebuild-install#custom-binaries%20couchbase_binary_host=http://their-server

Or you can do Local Prebuilds: https://github.com/prebuild/prebuild-install#local-prebuilds

Here are the 3.1.1 releases and binaries per os https://github.com/couchbase/couchnode/releases

josephstgh commented 3 years ago

So we tested this and it is does allow us to install the couchbase dependency without error but we are unable to connect to couchbase.

This is our .npmrc

registry = "http://myprivaterepo/artifactory/api/npm/npm/"
couchbase_binary_host = "http://myprivaterepo/artifactory/list/generic/couchbase/"

This is the sample script that I'm using

const {
  Ottoman, getModel, Schema, SearchConsistency,
} = require('ottoman');

const ottoman = new Ottoman();

ottoman.connect({
  connectionString: 'couchbase://localhost',
  bucketName: 'testBucket',
  username: 'user',
  password: 'password',
});

const modelOptions = {
  scopeName: 'messageScope',
  collectionName: 'messageCollection',
};

const schema = new Schema({
  text: { type: String },
});

// both way doesn't work
ottoman.model('message', schema);
// ottoman.model('message', schema, modelOptions);

ottoman.start().then(() => console.log('start'));

This is the error message with debug logs

bwgjoseph@OR-GBOONWE MINGW64 ~/Desktop/ottoman-native
$ node .
  couchnode:lcb:info (instance @ C:\Jenkins\workspace\nodejs\couchnode\couchnode-scripted-build-pipeline\couchnode\deps\lcb\src\instance.cc:503) Version=3.0.7-njs, Changeset=d2d3666e269b41413408aaae96eb289f1cb4f8ec +0ms
  couchnode:lcb:info (instance @ C:\Jenkins\workspace\nodejs\couchnode\couchnode-scripted-build-pipeline\couchnode\deps\lcb\src\instance.cc:504) Effective connection string: couchbase://localhost/testBucket?client_string=couchnode%2F3.1.1%20(node%2F14.16.0%3B%20v8%2F8.4.371.19-node.18%3B%20ssl%2F1.1.1j). Bucket=testBucket +1ms
  couchnode:lcb:debug (instance @ C:\Jenkins\workspace\nodejs\couchnode\couchnode-scripted-build-pipeline\couchnode\deps\lcb\src\instance.cc:372) Applying initial cntl client_string=couchnode/3.1.1 (node/14.16.0; v8/8.4.371.19-node.18; ssl/1.1.1j) +0ms
  couchnode:lcb:info (instance @ C:\Jenkins\workspace\nodejs\couchnode\couchnode-scripted-build-pipeline\couchnode\deps\lcb\src\instance.cc:195) DNS SRV lookup failed: LCB_ERR_UNKNOWN_HOST (1049). Ignore
this if not relying on DNS SRV records +12s
  couchnode:lcb:debug (instance @ C:\Jenkins\workspace\nodejs\couchnode\couchnode-scripted-build-pipeline\couchnode\deps\lcb\src\instance.cc:138) Adding host localhost:8091 to initial HTTP bootstrap list
+12s
  couchnode:lcb:debug (instance @ C:\Jenkins\workspace\nodejs\couchnode\couchnode-scripted-build-pipeline\couchnode\deps\lcb\src\instance.cc:138) Adding host localhost:11210 to initial CCCP bootstrap list +0ms
  couchnode:lcb:trace (instance @ C:\Jenkins\workspace\nodejs\couchnode\couchnode-scripted-build-pipeline\couchnode\deps\lcb\src\instance.cc:176) Bootstrap hosts loaded (cccp:1, http:1) +0ms
  couchnode:lcb:info (bootstrap @ C:\Jenkins\workspace\nodejs\couchnode\couchnode-scripted-build-pipeline\couchnode\deps\lcb\src\bootstrap.cc:270) Requested network configuration: heuristic +1ms
  couchnode:lcb:debug (confmon @ C:\Jenkins\workspace\nodejs\couchnode\couchnode-scripted-build-pipeline\couchnode\deps\lcb\src\bucketconfig\confmon.cc:94) Preparing providers (this may be called multiple times) +2ms
  couchnode:lcb:debug (confmon @ C:\Jenkins\workspace\nodejs\couchnode\couchnode-scripted-build-pipeline\couchnode\deps\lcb\src\bucketconfig\confmon.cc:100) Provider CCCP is ENABLED +0ms
  couchnode:lcb:debug (confmon @ C:\Jenkins\workspace\nodejs\couchnode\couchnode-scripted-build-pipeline\couchnode\deps\lcb\src\bucketconfig\confmon.cc:100) Provider HTTP is ENABLED +0ms
  couchnode:lcb:trace (confmon @ C:\Jenkins\workspace\nodejs\couchnode\couchnode-scripted-build-pipeline\couchnode\deps\lcb\src\bucketconfig\confmon.cc:314) Refreshing current cluster map (bucket: testBucket) +2ms
  couchnode:lcb:trace (confmon @ C:\Jenkins\workspace\nodejs\couchnode\couchnode-scripted-build-pipeline\couchnode\deps\lcb\src\bucketconfig\confmon.cc:300) Attempting to retrieve cluster map via CCCP +3ms
  couchnode:lcb:info (cccp @ C:\Jenkins\workspace\nodejs\couchnode\couchnode-scripted-build-pipeline\couchnode\deps\lcb\src\bucketconfig\bc_cccp.cc:176) Requesting connection to node localhost:11210 for CCCP configuration +6ms
  couchnode:lcb:debug (lcbio_mgr @ C:\Jenkins\workspace\nodejs\couchnode\couchnode-scripted-build-pipeline\couchnode\deps\lcb\src\lcbio\manager.cc:501) <localhost:11210> (HE=000001EF43328C60) Creating new connection because none are available in the pool +5ms
  couchnode:lcb:trace (lcbio_mgr @ C:\Jenkins\workspace\nodejs\couchnode\couchnode-scripted-build-pipeline\couchnode\deps\lcb\src\lcbio\manager.cc:413) <localhost:11210> (HE=000001EF43328C60) New pool entry: I=000001EF433C6760 +1ms
  couchnode:lcb:info (connection @ C:\Jenkins\workspace\nodejs\couchnode\couchnode-scripted-build-pipeline\couchnode\deps\lcb\src\lcbio\connect.cc:485) <localhost:11210> (SOCK=a3f0766200f336e5) Starting.
Timeout=2000000us +1ms
  couchnode:lcb:error (bootstrap @ C:\Jenkins\workspace\nodejs\couchnode\couchnode-scripted-build-pipeline\couchnode\deps\lcb\src\bootstrap.cc:198) Failed to bootstrap client=000001EF4342ED10. Error=LCB_ERR_TIMEOUT (201) (Last=LCB_ERR_TIMEOUT (201)), Message=Failed to bootstrap in time +0ms
  couchnode failed to connect to bucket: [Error: LCB_ERR_TIMEOUT (201): The request was not completed by the user-defined timeout] {
  couchnode   code: 201
  couchnode } +0ms
(node:10500) UnhandledPromiseRejectionWarning: Error: cluster object was closed
    at Connection.close (C:\Users\bwgjoseph\Desktop\ottoman-native\node_modules\couchbase\lib\connection.js:266:24)
    at C:\Users\bwgjoseph\Desktop\ottoman-native\node_modules\couchbase\lib\cluster.js:612:14
(Use `node --trace-warnings ...` to show where the warning was created)
(node:10500) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was
not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:10500) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.  couchnode:lcb:debug (lcbio_mgr @ C:\Jenkins\workspace\nodejs\couchnode\couchnode-scripted-build-pipeline\couchnode\deps\lcb\src\lcbio\manager.cc:523) <localhost:11210> (HE=000001EF43328C60) Request=000001EF433C6280 has no connection.. yet +9ms

I can access the couchbase UI without issue, so the service is up and running properly.

Tested the same script on internet machine, and it works fine too.

Questions:

In couchbase dependency, there are multiple "versions" like node-v64, node-v72 and so on. How to know which is the correct one that couchbase 3.1.1 is using? At the moment, we brought all into our private repository, and it seem to install the latest v83 one if I am correct.

Thanks!

deskoh commented 3 years ago

I think the node version corresponds to NODE_MODULE_VERSION found here. (See the footnote at the bottom of the page).

Node.js 14 corresponds to 83

bwgjoseph commented 3 years ago

Nice, learn something new

httpJunkie commented 3 years ago

So do you have this working now or are there still more questions around this issue?

bwgjoseph commented 3 years ago

Knowing the node version is just a side question.

The actual problem listed above with the logs still persist. Still unable to connect.

bwgjoseph commented 3 years ago

@httpJunkie in case this was missed, thanks!

deskoh commented 3 years ago

i think i figured out why the connection is failing. i enabled verbose debugging and saw below

  couchnode:lcb:info (instance @ C:\Jenkins\workspace\nodejs\couchnode\couchnode-scripted-build-pipeline\couchnode\deps\lcb\src\instance.cc:503) Version=3.0.7-njs, Changeset=d2d3666e269b41413408aaae96eb289f1cb4f8ec +0ms
  couchnode:lcb:info (instance @ C:\Jenkins\workspace\nodejs\couchnode\couchnode-scripted-build-pipeline\couchnode\deps\lcb\src\instance.cc:504) Effective connection string: couchbase://localhost:8091/testBucket?client_string=couchnode%2F3.1.1%20(node%2F14.15.5%3B%20v8%2F8.4.371.19-node.18%3B%20ssl%2F1.1.1i). Bucket=testBucket +2ms
  couchnode:lcb:debug (instance @ C:\Jenkins\workspace\nodejs\couchnode\couchnode-scripted-build-pipeline\couchnode\deps\lcb\src\instance.cc:372) Applying initial cntl client_string=couchnode/3.1.1 (node/14.15.5; v8/8.4.371.19-node.18; ssl/1.1.1i) +0ms
+  couchnode:lcb:info (instance @ C:\Jenkins\workspace\nodejs\couchnode\couchnode-scripted-build-pipeline\couchnode\deps\lcb\src\instance.cc:195) DNS SRV lookup failed: LCB_ERR_UNKNOWN_HOST (1049). Ignore this if not relying on DNS SRV records +12s

... truncated for brevity

  couchnode:lcb:error (bootstrap @ C:\Jenkins\workspace\nodejs\couchnode\couchnode-scripted-build-pipeline\couchnode\deps\lcb\src\bootstrap.cc:198) Failed to bootstrap client=0000018053F106A0. Error=LCB_ERR_TIMEOUT (201) (Last=LCB_ERR_TIMEOUT (201)), Message=Failed to bootstrap in time +0ms
  couchnode failed to connect to bucket: [Error: LCB_ERR_TIMEOUT (201): The request was not completed by the user-defined timeout] {
  couchnode   code: 201
  couchnode } +0ms
...

The DNS lookup is taking 12 seconds in offline environment. I intercepted the DNS request and realized its trying to lookup the following

SRV IN _couchbase._tcp.localhost.

When it's working the DNS lookup is about 12ms. Able to disable this DNS lookup?

deskoh commented 3 years ago

Found this.

Managed to connect using method:

connect({
  connectionString: 'couchbase://localhost?dnssrv=off',
  bucketName: 'testBucket',
  username: 'admin',
  password: 'password',
});

Is there a way to specify dnssrv=off using a single connection string? I tried the following but it does not work:

connect("couchbase://localhost/testBucket?dnssrv=off@admin:password");
connect("couchbase://localhost/testBucket@admin:password?dnssrv=off");
cychub commented 1 year ago

we are facing a similar issue, we set the yarn registry to our private registry, but we cannot access github for from external lib downloading, can you suggest the way to by-pass this issue? thank you in advance

[2023-02-09T07:54:00.244Z] [4/4] Building fresh packages...
[2023-02-09T07:56:21.900Z] error /var/app/node_modules/couchbase: Command failed.
[2023-02-09T07:56:21.903Z] Exit code: 1
[2023-02-09T07:56:21.903Z] Command: prebuild-install -r napi || cmake-js compile
[2023-02-09T07:56:21.904Z] Arguments: 
[2023-02-09T07:56:21.904Z] Directory: /var/app/node_modules/couchbase
[2023-02-09T07:56:21.904Z] Output:
[2023-02-09T07:56:21.904Z] prebuild-install warn install connect ETIMEDOUT 20.205.243.166:443
[2023-02-09T07:56:21.904Z] [
[2023-02-09T07:56:21.904Z]   '/usr/local/bin/node',
[2023-02-09T07:56:21.904Z]   '/var/app/node_modules/couchbase/node_modules/.bin/cmake-js',
[2023-02-09T07:56:21.904Z]   'compile'
[2023-02-09T07:56:21.904Z] ]
[2023-02-09T07:56:21.904Z] info TOOL Using Unix Makefiles generator.
[2023-02-09T07:56:21.904Z] info DIST Downloading distribution files to: /root/.cmake-js/node-x64/v14.19.3
[2023-02-09T07:56:21.904Z] http DIST    - https://nodejs.org/dist/v14.19.3/SHASUMS256.txt
[2023-02-09T07:56:21.904Z] http DIST    - https://nodejs.org/dist/v14.19.3/node-v14.19.3-headers.tar.gz
[2023-02-09T07:56:21.904Z] info REP Build has been failed, trying to do a full rebuild.
[2023-02-09T07:56:21.904Z] ERR! OMG CMake executable is not found. Please use your system's package manager to install it, or you can get installers from there: http://cmake.org.
[2023-02-09T07:56:21.904Z] info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.
[2023-02-09T07:56:21.904Z] The command '/bin/sh -c yarn install' returned a non-zero code: 1
bwgjoseph commented 1 year ago

hi @cychub, I suggest you make a report at https://github.com/couchbaselabs/node-ottoman