ibmdb / node-ibm_db

IBM DB2 and IBM Informix bindings for node
MIT License
192 stars 150 forks source link

Problem deploying project to Bluemix with ibm_db #462

Closed erezlevi closed 6 years ago

erezlevi commented 6 years ago

I can't seems to be able to deploy a project using the nodejs-buildpack on bluemix to one of IBM customers. I am attaching here the console log from the bluemix output: It seems it is looking for Window.h file and can't find it in the module ? Tried both 2.4.0 and 2.4.1 with no success. please advise.

2018-10-02T18:22:04.71+0300 [API/4] OUT Updated app with guid 21bc674a-ef61-4356-82ae-dcb2d241955e ({"name"=>"AudioCodesGrammerUploadTest", "command"=>"PRIVATE DATA HIDDEN", "instances"=>1, "memory"=>256, "environment_json"=>"PRIVATE DATA HIDDEN"}) 2018-10-02T18:23:49.30+0300 [API/2] OUT Creating build for app with guid 21bc674a-ef61-4356-82ae-dcb2d241955e 2018-10-02T18:23:54.49+0300 [API/2] OUT Updated app with guid 21bc674a-ef61-4356-82ae-dcb2d241955e ({"state"=>"STARTED"}) 2018-10-02T18:23:55.47+0300 [STG/0] OUT Downloaded nodejs_buildpack 2018-10-02T18:23:55.47+0300 [STG/0] OUT Downloading binary_buildpack... 2018-10-02T18:23:55.47+0300 [STG/0] OUT Downloaded go_buildpack 2018-10-02T18:23:55.47+0300 [STG/0] OUT Downloaded xpages_buildpack 2018-10-02T18:23:55.47+0300 [STG/0] OUT Downloading liberty_v3_14-20171013-1023... 2018-10-02T18:23:55.48+0300 [STG/0] OUT Downloaded python_buildpack 2018-10-02T18:23:55.48+0300 [STG/0] OUT Downloading sdk-for-nodejs_v3_21-20180628-1258... 2018-10-02T18:23:55.47+0300 [STG/0] OUT Downloading liberty-for-java_v3_17_1-20180131-1532... 2018-10-02T18:23:55.47+0300 [STG/0] OUT Downloaded sdk-for-nodejs_v3_22-20180904-1913 2018-10-02T18:23:55.66+0300 [STG/0] OUT Downloaded dotnet-core_v1_0_26-20170913-1346 2018-10-02T18:23:55.66+0300 [STG/0] OUT Downloaded liberty-for-java_v3_24-20180806-1313 2018-10-02T18:23:55.73+0300 [STG/0] OUT Creating container 2018-10-02T18:23:55.71+0300 [STG/0] OUT Downloaded dotnet-core_v2_0-20180918-1356 2018-10-02T18:24:06.00+0300 [STG/0] OUT Downloaded build artifacts cache (2.3M) 2018-10-02T18:24:06.00+0300 [STG/0] OUT Staging... 2018-10-02T18:24:09.20+0300 [STG/0] OUT -----> IBM SDK for Node.js Buildpack v3.22-20180904-1913 2018-10-02T18:24:09.22+0300 [STG/0] OUT Based on Cloud Foundry Node.js Buildpack v1.5.24 2018-10-02T18:24:16.13+0300 [STG/0] OUT -----> Building dependencies 2018-10-02T18:24:16.15+0300 [STG/0] OUT Rebuilding any native modules 2018-10-02T18:24:16.14+0300 [STG/0] OUT Prebuild detected (node_modules already exists) 2018-10-02T18:24:25.65+0300 [STG/0] OUT Rebuild Process: Found clidriver at -> /tmp/app/node_modules/ibm_db/installer/clidriver 2018-10-02T18:24:25.65+0300 [STG/0] OUT
2018-10-02T18:24:25.65+0300 [STG/0] OUT
2018-10-02T18:24:25.65+0300 [STG/0] OUT Downloading of clidriver skipped - build is in progress... 2018-10-02T18:24:29.06+0300 [STG/0] OUT
2018-10-02T18:24:29.06+0300 [STG/0] OUT CXX(target) Release/obj.target/odbc_bindings/src/odbc.o 2018-10-02T18:24:29.06+0300 [STG/0] OUT make: Leaving directory /tmp/app/node_modules/ibm_db/build' 2018-10-02T18:24:29.07+0300 [STG/0] OUT /tmp/app/node_modules/ibm_db/installer/clidriver/include/sqlcli1.h:41:21: fatal error: windows.h: No such file or directory 2018-10-02T18:24:29.06+0300 [STG/0] OUT make: Entering directory/tmp/app/node_modules/ibm_db/build' 2018-10-02T18:24:29.07+0300 [STG/0] OUT { Error: Command failed: node-gyp configure build --IS_DOWNLOADED=true --IBM_DB_HOME="$IBM_DB_HOME" 2018-10-02T18:24:29.07+0300 [STG/0] OUT #include 2018-10-02T18:24:29.07+0300 [STG/0] OUT ^ 2018-10-02T18:24:29.07+0300 [STG/0] OUT make: *** [Release/obj.target/odbc_bindings/src/odbc.o] Error 1 2018-10-02T18:24:29.07+0300 [STG/0] OUT gyp ERR! stack at emitTwo (events.js:106:13) 2018-10-02T18:24:29.07+0300 [STG/0] OUT gyp ERR! stack at ChildProcess.emit (events.js:191:7) 2018-10-02T18:24:29.07+0300 [STG/0] OUT gyp ERR! stack Error: make failed with exit code: 2 2018-10-02T18:24:29.07+0300 [STG/0] OUT gyp ERR! System Linux 4.4.0-109-generic 2018-10-02T18:24:29.07+0300 [STG/0] OUT gyp ERR! cwd /tmp/app/node_modules/ibm_db 2018-10-02T18:24:29.07+0300 [STG/0] OUT gyp ERR! not ok 2018-10-02T18:24:29.07+0300 [STG/0] OUT
2018-10-02T18:24:29.07+0300 [STG/0] OUT at ChildProcess.exithandler (child_process.js:199:12) 2018-10-02T18:24:29.07+0300 [STG/0] OUT compilation terminated. 2018-10-02T18:24:29.07+0300 [STG/0] OUT gyp ERR! build error 2018-10-02T18:24:29.07+0300 [STG/0] OUT gyp ERR! node -v v6.14.4 2018-10-02T18:24:29.07+0300 [STG/0] OUT gyp ERR! node-gyp -v v3.4.0 2018-10-02T18:24:29.07+0300 [STG/0] OUT at emitTwo (events.js:106:13) 2018-10-02T18:24:29.07+0300 [STG/0] OUT at ChildProcess.emit (events.js:191:7) 2018-10-02T18:24:29.07+0300 [STG/0] OUT In file included from ../src/odbc.h:27:0, 2018-10-02T18:24:29.07+0300 [STG/0] OUT from ../src/odbc.cpp:28: 2018-10-02T18:24:29.07+0300 [STG/0] OUT gyp ERR! stack at ChildProcess.onExit (/tmp/app/vendor/node/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:276:23) 2018-10-02T18:24:29.07+0300 [STG/0] OUT gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:219:12) 2018-10-02T18:24:29.07+0300 [STG/0] OUT gyp ERR! command "/tmp/app/vendor/node/bin/node" "/tmp/app/vendor/node/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "configure" "build" "--IS_DOWNLOADED=true" "--IBM_DB_HOME=/tmp/app/node_modules/ibm_db/installer/clidriver" 2018-10-02T18:24:29.08+0300 [STG/0] OUT at maybeClose (internal/child_process.js:920:16) 2018-10-02T18:24:29.08+0300 [STG/0] OUT
2018-10-02T18:24:29.08+0300 [STG/0] OUT killed: false, 2018-10-02T18:24:29.08+0300 [STG/0] OUT code: 1, 2018-10-02T18:24:29.08+0300 [STG/0] OUT signal: null, 2018-10-02T18:24:29.08+0300 [STG/0] OUT cmd: 'node-gyp configure build --IS_DOWNLOADED=true --IBM_DB_HOME="$IBM_DB_HOME"' } 2018-10-02T18:24:29.08+0300 [STG/0] OUT at Process.ChildProcess._handle.onexit (internal/child_process.js:230:5) 2018-10-02T18:24:29.10+0300 [STG/0] OUT npm ERR! argv "/tmp/app/vendor/node/bin/node" "/tmp/app/vendor/node/bin/npm" "rebuild" "--nodedir=/tmp/app/vendor/node" 2018-10-02T18:24:29.10+0300 [STG/0] OUT npm ERR! Exit status 1 2018-10-02T18:24:29.10+0300 [STG/0] OUT npm ERR! not with npm itself. 2018-10-02T18:24:29.10+0300 [STG/0] OUT npm ERR! Tell the author that this fails on your system: 2018-10-02T18:24:29.11+0300 [STG/0] OUT npm ERR! There is likely additional logging output above. 2018-10-02T18:24:29.10+0300 [STG/0] OUT npm ERR! node v6.14.4 2018-10-02T18:24:29.10+0300 [STG/0] OUT npm ERR! code ELIFECYCLE 2018-10-02T18:24:29.10+0300 [STG/0] OUT npm ERR! ibm_db@2.4.1 install: node installer/driverInstall.js 2018-10-02T18:24:29.10+0300 [STG/0] OUT npm ERR! Make sure you have the latest version of node.js and npm installed. 2018-10-02T18:24:29.10+0300 [STG/0] OUT npm ERR! node installer/driverInstall.js 2018-10-02T18:24:29.10+0300 [STG/0] OUT npm ERR! You can get information on how to open an issue for this project with: 2018-10-02T18:24:29.10+0300 [STG/0] OUT npm ERR! npm v3.10.10 2018-10-02T18:24:29.10+0300 [STG/0] OUT npm ERR! Failed at the ibm_db@2.4.1 install script 'node installer/driverInstall.js'. 2018-10-02T18:24:29.10+0300 [STG/0] OUT npm ERR! If you do, this is most likely a problem with the ibm_db package, 2018-10-02T18:24:29.10+0300 [STG/0] OUT npm ERR! npm bugs ibm_db 2018-10-02T18:24:29.10+0300 [STG/0] OUT npm ERR! Or if that isn't available, you can get their info via: 2018-10-02T18:24:29.10+0300 [STG/0] OUT npm ERR! Linux 4.4.0-109-generic 2018-10-02T18:24:29.10+0300 [STG/0] OUT npm ERR! 2018-10-02T18:24:29.11+0300 [STG/0] OUT npm ERR! npm owner ls ibm_db 2018-10-02T18:24:29.11+0300 [STG/0] OUT
2018-10-02T18:24:29.11+0300 [STG/0] OUT npm ERR! /tmp/app/npm-debug.log 2018-10-02T18:24:29.11+0300 [STG/0] OUT npm ERR! Please include the following file with any support request: 2018-10-02T18:24:29.20+0300 [STG/0] OUT -----> Build failed 2018-10-02T18:24:29.28+0300 [STG/0] OUT http://docs.cloudfoundry.org/buildpacks/node/node-tips.html 2018-10-02T18:24:29.30+0300 [STG/0] ERR Failed to compile droplet: Failed to compile droplet: exit status 1 2018-10-02T18:24:29.28+0300 [STG/0] OUT
2018-10-02T18:24:29.28+0300 [STG/0] OUT http://docs.cloudfoundry.org/buildpacks/node/node-tips.html 2018-10-02T18:24:29.28+0300 [STG/0] OUT
2018-10-02T18:24:29.28+0300 [STG/0] OUT - Node version not specified in package.json 2018-10-02T18:24:29.28+0300 [STG/0] OUT Some possible problems: 2018-10-02T18:24:29.28+0300 [STG/0] OUT
2018-10-02T18:24:29.28+0300 [STG/0] OUT - node_modules checked into source control 2018-10-02T18:24:29.28+0300 [STG/0] OUT
2018-10-02T18:24:29.37+0300 [STG/0] OUT Exit status 223

rhtpandeyIN commented 6 years ago

it's strange, is this deployment platform dependent? I mean, in which platform this application is getting build,is it Windows specific? If it is Windows, then it seems - in that system Win32 API library is missing. Also, for Windows(If you want to compile and build) you will need to install "msbuild" and most preferably Visual Studio 2013/2015 (it comes with compiler and all Windows related SDKs/Libraries).

Windows.h should be inside : C:\Program Files (x86)\Windows Kits\8.1\Include\um
erezlevi commented 6 years ago

The application resides on IBM Bluemix - https://console.bluemix.net Which is part of IBM Cloud solutions for customers. but you know that allready... The IBM Bluemix nodejs resides on Linux OS. Did you guys tested your solution on IBM Bluemix ?

By the way, on my dev machine which is win7 and Visual Studio 2017 it is working as expected, when performing then you get the error on bluemix container.

huineng commented 6 years ago

how is this deployed ? travis ? cloud foundry ?

erezlevi commented 6 years ago

how is this deployed ? travis ? cloud foundry ?

Cloud Foundry using bluemix cli push command

huineng commented 6 years ago

I'm sorry to hear that . maybe start by adding a node version in your package json eg

"engines": {
        "node": "9.11.2",
        "npm": "5.6.0"
    },

have you tried using 2.3.1 (is there a particular reason for 2.4 x ? (as i still have other issues with these 2.4x release)

i also see that you are using the ibm node sdk , you can maybe try in install it using the latest node.js buildpack

cf push my-nodejs-app -b https://github.com/cloudfoundry/nodejs-buildpack

let me know

erezlevi commented 6 years ago

Will do that tonight. thanks. I will try 2.3.1 all i need to do is on package.json to change: "ibm_db": "^2.4.1" to: "ibm_db": "^2.3.0", right ?

BTW tried with "ibm_db": "^1.0.2" and it didn't work but for different reasons.

huineng commented 6 years ago

don't use the ^ but "ibm_db": "2.3.1",

npm install --save --save-exact ibm_db@2.3.1

erezlevi commented 6 years ago

OK tried all the things and with all of them it keeps writing that window.h file is missing. tried with nodejs 9.11.2 and also npm 5.6.0 like you wrote nothing changed.

Do you have a release without the window.h in the installer ? If you have a previous release without window.h file ?

bimalkjha commented 6 years ago

Please share your latest install output after package.json update. We do not ship windows.h file and not shipped in past too. Anyway, windows installation should work without windows.h as when compilation fails , ibm_db uses pre-compiled binary as next step on windows. So, it should work. Thanks.

bimalkjha commented 6 years ago

@erezlevi If you open /tmp/app/node_modules/ibm_db/installer/clidriver/include/sqlcli1.h file and check line no 41, you can see below code:

#if defined(DB2NT)
#include <windows.h>
#endif

It says, ibm_db will look for windows.h only on Windows platform. So, something seems wrong with your setup. Are you pushing code from your windows system on bluemix?

In your log, we can see below text:

2018-10-03T17:44:43.54+0300 [STG/0] OUT Rebuild Process: Found clidriver at -> /tmp/app/node_modules/ibm_db/installer/clidriver

How clidriver came here? I do not see any log for downloading clidriver. I guess this clidriver is of windows platform and getting pushed from your local system and causing the problem. Thanks.

huineng commented 6 years ago

have you created a .cfignore file where you exclude node_modules/ ?

erezlevi commented 6 years ago

have you created a .cfignore file where you exclude node_modules/ ?

No.

erezlevi commented 6 years ago

It says, ibm_db will look for windows.h only on Windows platform. So, something seems wrong with your setup. Are you pushing code from your windows system on bluemix?

I am pushing the code from my windows 7 to bluemix using bluemix app push command as i've done for all my apps.

How clidriver came here? I do not see any log for downloading clidriver. I guess this clidriver is of windows platform and getting pushed from your local system and causing the problem. Thanks.

The clidriver comes from bluemix uploading all node-modules by itself. I can try uploading everything without the node-modules in my pc.

huineng commented 6 years ago

well the proper way to do this is to create a .cfignore file excluding node_module then when you upload it will be the server that will install all your modules .. you always have a clean install

...and technically only the dependencies and not your devdependencies

so this is the reason why you have your issues, you try to upload your windows install into a linux container

erezlevi commented 6 years ago

Hi,

Thanks alot for all your help! Removing the node-modules from the project locally on my windows and then pushing the project solved the problem.