oracle / node-oracledb

Oracle Database driver for Node.js maintained by Oracle Corp.
http://oracle.github.io/node-oracledb/
Other
2.24k stars 1.07k forks source link

Node-oracledb v6.0.0 throws a `SystemError` when running with user without home directory #1564

Closed tomirantanen closed 1 year ago

tomirantanen commented 1 year ago

1. What versions are you using?

OS: Alpine Linux 3.16 (Dockerhub image tag: node:18.16.0-alpine3.16) node.js: v18.16.0 node-oracledb: 6.0.0

2. Is it an error or a hang or a crash?

Node.js process throws a SystemError and crashes.

3. What error(s) or behavior you are seeing?

I’m using node-oracledb inside a docker container in Kubernetes cluster, where containers are started with random user. Thus, the container doesn’t have home directory for the user.

node-oracledb uses os.userInfo() to get the user information. This will throw a SystemError if home directory doesn’t exist. https://nodejs.org/api/os.html#osuserinfooptions

Full error message:

node:internal/errors:490
     ErrorCaptureStackTrace(err);
     ^

SystemError [ERR_SYSTEM_ERROR]: A system error occurred: uv_os_get_passwd returned ENOENT (no such file or directory)
    at new SystemError (node:internal/errors:250:5)
    at new NodeError (node:internal/errors:361:7)
    at Object.userInfo (node:os:366:11)
    at Object.<anonymous> (/node_modules/oracledb/lib/thin/sqlnet/navNodes.js:446:64)
    at Module._compile (node:internal/modules/cjs/loader:1254:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1308:10)
    at Module.load (node:internal/modules/cjs/loader:1117:32)
    at Module._load (node:internal/modules/cjs/loader:958:12)
    at Module.require (node:internal/modules/cjs/loader:1141:19)
    at require (node:internal/modules/cjs/helpers:110:18) {
  code: 'ERR_SYSTEM_ERROR',
  info: {
    errno: -2,
    code: 'ENOENT',
    message: 'no such file or directory',
    syscall: 'uv_os_get_passwd'
  },
  errno: [Getter/Setter],
  syscall: [Getter/Setter]
}

4. Include a runnable Node.js script that shows the problem.

Check the minimum example with dockerfile included in: https://github.com/tomirantanen/oracledb-issue

anthony-tuininga commented 1 year ago

Thanks for the report. I am able to replicate it and will come up with a solution.

sharadraju commented 1 year ago

@tomirantanen This has been fixed in the latest 6.0.3 release.