loopbackio / loopback-next

LoopBack makes it easy to build modern API applications that require complex integrations.
https://loopback.io
Other
4.96k stars 1.07k forks source link

Model discovery not working with Oracle connector & CDB instance #3296

Closed bigal-cloud closed 5 years ago

bigal-cloud commented 5 years ago

Steps to reproduce

  1. Have running Oracle CDB/PDB instance
  2. lsnrctl services to get connection info:
Service "mypdb" has 1 instance(s).
  Instance "oracleal", status READY, has 2 handler(s) for this service...
    Handler(s):
      "D000" established:0 refused:0 current:1 max:1022 state:ready
         DISPATCHER <machine: dev-3867, pid: 15272>
         (ADDRESS=(PROTOCOL=tcp)(HOST=dev-3867)(PORT=49939))
      "DEDICATED" established:2 refused:0 state:ready
         LOCAL SERVER
  1. lb4 datasource:
{
  "name": "ABX",
  "connector": "oracle",
  "tns": "",
  "host": "dev-3867",
  "port": 49939,
  "user": "fx_owner",
  "password": "dev",
  "database": "mypdb"
}
  1. npm run build
  2. lb4 discover - select a model and hit enter

Current Behavior

PS C:\Users\Lake\Documents\test-adapter\serverx\serverx> lb4 discover
? Select the connector to discover ABX
? Select the models which to discover RFF_RESPONSE
events.js:170
      throw er; // Unhandled 'error' event
      ^

Error: NJS-002: invalid pool
Emitted 'error' event at:
    at Immediate.setImmediate (C:\Users\Lyme\AppData\Roaming\npm\node_modules\@loopback\cli\node_modules\yeoman-generator\lib\index.js:436:22)
    at processImmediate (internal/timers.js:443:21)
PS C:\Users\Lyme\Documents\jtds-test-adapter\serverx\serverx>

Expected Behavior

To create a model

Link to reproduction sanbox

Additional information

It was working fine in previous versions

Related Issues

See Reporting Issues for more tips on writing good issues

bajtos commented 5 years ago

@bigal-cloud thank you for reporting the issue. What is the version of @loopback/repository and loopback-connector-oracle that you are using?

It was working fine in previous versions

Please be more specific, what is the last version where this worked and what is the first version where it stopped to work?

bajtos commented 5 years ago

@raymondfeng you are most familiar with the Oracle connector, PTAL.

bigal-cloud commented 5 years ago

Hello @bajtos , thanks for replying.

I am using: @loopback/repository v 1.8.2 loopback-connector-oracle v 4.2.0

For the other questions I need a little more time.

bigal-cloud commented 5 years ago

The last working version was: @loopback/cli@1.16.0

The first non working version was: @loopback/cli@1.17.0

Tavisco commented 5 years ago

Getting the exact same results over here.

I'm using those versions:

@loopback/repository@1.12.0
loopback-connector-oracle@4.3.0
@loopback/cli@1.21.4
dhmlau commented 5 years ago

I think this is something we should take a look and try to reproduce from our end in Q4, if not sooner.

raymondfeng commented 5 years ago

Can you try to install https://github.com/oracle/node-oracledb and see if https://github.com/oracle/node-oracledb/blob/master/examples/example.js is working for you? We use oracledb behind the scene.

emonddr commented 5 years ago

@bigal-cloud @Tavisco , please see @raymondfeng 's comment. :)

Tavisco commented 5 years ago

Hi @emonddr sorry for the late reply. I don't have access write to the database I'm testing with, so i've ran only the last part of the example.js file that selects the current date from dual, and it worked as expected.

raymondfeng commented 5 years ago

I'm able to reproduce the problem now. Will take a look tomorrow.

raymondfeng commented 5 years ago

Please try loopback-connector-oracle@4.5.0

Tavisco commented 5 years ago

Using loopback-connector-oracle@4.5.0 I was able to run lb4 discover successfully, thanks for the fix.