Node-oracledb: Not working on Electron 1.2.0 and 1.2.1. Works with Electron 1.1.0

Created on 6 Jun 2016  ·  18Comments  ·  Source: oracle/node-oracledb

When we use it with Electron (1.2.0 and 1.2.1) getConnection method throws "Error: NJS-008: invalid type for "stmtCacheSize" in parameter 1" if stmtCacheSize not specified in connections string. When you set the parameter in connections string to a valid value, it causes the application to crash.
We have no problem with node.js or Electron 1.1.0.
I have attached a sample project to reproduce the problem.
electron-oracledb-problem.zip

Most helpful comment

If anyone blogs on this, let me know. It would be cool to see a complete end to end set of instructions showing how to build an app

All 18 comments

Some simple requests!:

  • Platform?
  • Node-oracledb version? (Use 1.9.3)
  • Define 'crash'? Got a stack trace?
  • Oracle client version?
  • Are you using an oraaccess.xml file with auto tuning of the statement cache?
  • Testcase that doesn't use electron?
  • Platform: OS X El Capitan 10.11.5
  • Node-oracledb version: 1.9.3 (Tried with 1.8 and nothing changed though)
  • Define 'crash'? Got a stack trace: Screen goes white. Unfortunately developer tools disconnect and no trace could be retrieven. However if you call getConnection on electron "app.ready" handler electron application totally crashes. Please find attached that crash log.
  • Oracle client version : Client Shared Library 64-bit - 11.2.0.4.0 (instant client)
  • Are you using an oraaccess.xml file with auto tuning of the statement cache : no
  • Testcase that doesn't use electron : It runs without electron when used as a node.js app. The problem exists with Electron 1.2.0 and 1.2.1

electron.app-crashlog.txt

Can you give some instructions on how you installed and ran and what you clicked and saw?

I'm seeing "Uncaught Error: Module version mismatch. Expected 48, got 46." probably related to https://github.com/nodejs/nan/issues/578#issuecomment-222692289

Let me know what you installed & how.

I came across the same problem at the beginning. I guess it is related to node version and oracledb mismatch. I overcame it by clean compilation of node_modules after installing node v6.2.0. Make sure oracledb recompiles during reinstall. If it does not work let me know and i will clean my environment and prepare a full installation map.

@irfannuri can you send the instructions? I don't want to spend time chasing ghosts just because I didn't have some component installed the way you have it installed.

I wouldn't be surprised if this is the compat issue I referenced earlier (which links to https://github.com/electron/electron/issues/5851). Even after I install Node 6.2, and have node-oracledb built with it, your sample app displays the version as 6.1. The NJS-008 is just a catchall error (should possibly be an internal error) in https://github.com/oracle/node-oracledb/blob/v1.9.3/src/njs/src/njsUtils.h#L293 (called from https://github.com/oracle/node-oracledb/blob/v1.9.3/src/njs/src/njsOracle.cpp#L741). I don't know why node-oracledb built for Node 6.2 is not given a version mismatch error when used with 6.1, but the version mismatch sure looks suspicious.

@irfannuri From reading https://github.com/electron/electron/issues/5851 it looks more & more like an Electron issue. As a test, you could try installing electron and then rebuilding node-oracledb with the version of V8 that Electron uses.
[edit: fix link]

@cjbj thanks a lot, I will give it a try and let you know.

@irfannuri Any luck?

You might want to add a comment to the Electron issue about what you are trying to do.

@cjbj unfortunately not. I have downgraded my node.js to 6.1.0 but the problem still exists.
I have reproduced the same problem on another Mac and sending the steps I have followed below. I am also going to open an issue for electron as well.
• Install npm (mine is v2.15.1)
• Install node v6.1.0
o sudo npm cache clean –f
o sudo npm install -g n
o sudo n 6.1.0
• Install Oracle Instant Client from http://www.oracle.com/technetwork/topics/intel-macsoft-096467.html
• Install node-oracledb following instructions at [https://github.com/oracle/node-oracledb/blob/master/INSTALL.md]
• Run npm install in the sample Project I have uploaded
• Click Test Connection button and you will get the error in the console : “Error: NJS-008: invalid type for "stmtCacheSize" in parameter 1”
• Uncomment the line “,stmtCacheSize: 10” in “renderer.js” and re-run Project. This time you will face a white screen right after you click Test Connection buton.

@irfannuri I'm not planning on looking at any of this until Electron is fixed. You can see Node & Electron have plans, e.g. https://github.com/electron/electron/issues/5851#issuecomment-226093160

@cjbj ok, thanks for your effort so far.

@cjbj I figured it out, it seems I have missed the native module usage in electron described here https://github.com/electron/electron/blob/master/docs/tutorial/using-native-node-modules.md. I just installed electron-rebuild package and run node_modules/.bin/electron-rebuild -f -w oracledb . This rebuilds oracledb package for electron. What misdirected me was it worked with electron 1.1.0, probably they are sort of binary compatible. Currently my working configuration is oracledb v1.9.3, electron-prebuilt v1.2.3, electron-rebuild 1.1.5 and node v6.1.0. It works both in Mac and Windows now, though we have some minor problems in windows which are unrelated and may be misusage.

Sorry for the trouble and thanks again for your interest.

I can confirm that node_modules/.bin/electron-rebuild -f -w oracledb solves this issue as well. I am running Windows 10 with oracledb v1.9.3, electron-prebuilt v1.2.3, electron-rebuild v1.1.5 and node v6.2.1 (and npm v3.10.2).

@cjbj and @irfannuri, Thank you so much for your comments. Especially your last comment @irfannuri.

When I ran electron main.js for my app to run, it would show this error:

[2016-06-21 13:53:09.609] [ERROR] console - App threw an error during load
[2016-06-21 13:53:09.610] [ERROR] console - Error: A dynamic link library (DLL) initialization routine failed.
\\?\C:\Users\Hair4\Projects\chemtrack-sds-search\node_modules\oracledb\build\Release\oracledb.node
    at Error (native)
    at process.module.(anonymous function) [as dlopen] (ELECTRON_ASAR.js:158:20)
    at Object.Module._extensions..node (module.js:568:18)
    at Object.module.(anonymous function) [as .node] (ELECTRON_ASAR.js:158:20)
    at Module.load (module.js:456:32)
    at tryModuleLoad (module.js:415:12)
    at Function.Module._load (module.js:407:3)
    at Module.require (module.js:466:17)
    at require (internal/module.js:20:19)
    at Object.<anonymous> (C:\Users\Hair4\Projects\chemtrack-sds-search\node_modules\oracledb\lib\oracledb.js:32:19)
    at Module._compile (module.js:541:32)
    at Object.Module._extensions..js (module.js:550:10)
    at Module.load (module.js:456:32)
    at tryModuleLoad (module.js:415:12)
    at Function.Module._load (module.js:407:3)
    at Module.require (module.js:466:17)

After running npm install --save-dev electron-rebuild and npm install --save-dev electron-rebuilt (I had electron-rebuilt installed before), I ran the command as you directed @irfannuri, node_modules/.bin/electron-rebuild -f -w oracledb. At first, I got errors with this command, until I added these to my .npmrc file:

runtime = electron
target_arch = x64
target = 1.2.3
disturl = https://atom.io/download/atom-shell
progress = true

Previously, I didn't have target = 1.2.3 because I can't run npm install with the target in the .npmrc because it gives many errors. So every time I run electron-rebuilt or anything electron, I have to add target=1.2.3 and whenever I do an npm install, I have to remove it...

That being said, after running the command, I ran electron main.js again and that error is now solved! I am still getting errors about things not being defined, but I think that is a discussion on another thread.

Thank you again.

@danielmhair ok man, thanks for .npmrc stuff, I shall watch out for it in our windows packages.

If anyone blogs on this, let me know. It would be cool to see a complete end to end set of instructions showing how to build an app

Hi,

I am running Windows 7 with oracledb v1.10.0, electron-prebuilt v1.2.2, electron-rebuild v1.1.5 and node v0.12.7 (and npm v2.11.3). I get this error on "node_modules/.bin/electron-rebuild -f -w oracledb" command:

gyp info it worked if it ends with ok
gyp info using [email protected]
gyp info using [email protected] | win32 | x64
gyp http GET https://gh-contractor-zcbenz.s3.amazonaws.com/atom-shell/dist/v1.2.2/iojs-v1.2.2.tar.gz
gyp WARN install got an error, rolling back install
gyp ERR! install error
gyp ERR! stack Error: certificate not trusted
gyp ERR! stack at Error (native)
gyp ERR! stack at TLSSocket. (_tls_wrap.js:929:36)
gyp ERR! stack at TLSSocket.emit (events.js:104:17)
gyp ERR! stack at TLSSocket._finishInit (_tls_wrap.js:460:8)
gyp ERR! System Windows_NT 6.1.7601
gyp ERR! command "node" "H:\electron-quick-start\node_modules\electron-rebuild\node_modules\npm\node_modules\node
-gyp\bin\node-gyp.js" "install" "--target=1.2.2" "--arch=x64" "--dist-url=https://gh-contractor-zcbenz.s3.amazonaws.co
m/atom-shell/dist"
gyp ERR! cwd H:\electron-quick-start
gyp ERR! node -v v0.12.7
gyp ERR! node-gyp -v v3.4.0
gyp ERR! not ok

Process exited with code: 1
Error: Process exited with code: 1
at ChildProcess. (H:\electron-quick-start\node_modules\electron-rebuild\lib\spawn.js:55:26)
at ChildProcess.emit (events.js:110:17)
at maybeClose (child_process.js:1015:16)
at Process.ChildProcess._handle.onexit (child_process.js:1087:5)

Please advise why I might be getting this error. Thank you!

@tulinn Focus on this portion of your error stack:

gyp ERR! stack Error: certificate not trusted
gyp ERR! stack at Error (native)
gyp ERR! stack at TLSSocket. (_tls_wrap.js:929:36)
gyp ERR! stack at TLSSocket.emit (events.js:104:17)
gyp ERR! stack at TLSSocket._finishInit (_tls_wrap.js:460:8)
gyp ERR! System Windows_NT 6.1.7601
gyp ERR! command "node" "H:\electron-quick-start\node_modules\electron-rebuild\node_modules\npm\node_modules\node
-gyp\bin\node-gyp.js" "install" "--target=1.2.2" "--arch=x64" "--dist-url=https://gh-contractor-zcbenz.s3.amazonaws.co
m/atom-shell/dist"

The install tried to pull from this URL: https://gh-contractor-zcbenz.s3.amazonaws.com/atom-shell/dist

A certificate error was raised.

Was this page helpful?
0 / 5 - 0 ratings