Hey experts.
Having a struggle here that I can't seem to solve by my self. I have a NODE.JS app running in a Docker container using NGINX as front end. All deployed on a Always Free Oracle Linux VM. My application is using Oracle NoSQL Database Cloud. Everything is working fine locally on my developer instance but when deploying my code to the server exposing my services with NGINX I get the below error:
{ NoSQLAuthorizationError: [ILLEGAL_ARGUMENT] Authorization error: [invalid arguments]: Error creating private key; Caused by: crypto.createPrivateKey is not a function
at Function.invalidArg (/usr/src/app/node_modules/oracle-nosqldb/lib/error.js:369:16)
at Function.privateKeyFromPEM (/usr/src/app/node_modules/oracle-nosqldb/lib/auth/iam/utils.js:68:43)
at Function.privateKeyFromPEMFile (/usr/src/app/node_modules/oracle-nosqldb/lib/auth/iam/utils.js:96:26)
at <anonymous>
_errCode:
ErrorCode {
_ordinal: 4,
_desc: undefined,
_name: 'ILLEGAL_ARGUMENT',
retryable: false },
name: 'NoSQLAuthorizationError',
_cause: TypeError: crypto.createPrivateKey is not a function
at Function.privateKeyFromPEM (/usr/src/app/node_modules/oracle-nosqldb/lib/auth/iam/utils.js:62:27)
at Function.privateKeyFromPEMFile (/usr/src/app/node_modules/oracle-nosqldb/lib/auth/iam/utils.js:96:26)
at <anonymous>,
_req:
{ api: [Function: get],
tableName: 'ServiceConfig',
key: { instanceUuid: '2bb4605f-ab08-41c2-8c5f-dca2d3706732' },
opt: { requestTimeout: 5000 },
_op: [Function: GetOp] } }
(node:6) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'row' of null
at /usr/src/app/app.js:182:21
at <anonymous>
(node:6) 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(). (rejection id: 2)
The code that I am using to connect to the NoSQL service looks like this:
//--------------------------------------------------------
const NoSQLClient = require('oracle-nosqldb').NoSQLClient;
let client = new NoSQLClient({
region: 'eu-frankfurt-1',
compartment: 'myCompartment',
auth: {
iam: {
tenantId: 'tenantId',
userId: 'userId',
fingerprint: 'fingerprint',
privateKeyFile: 'oci_api_key.pem'
}
}
});
var result = await client.get('ServiceConfig', { instanceUuid: "someId" });
//--------------------------------------------------------
Anybody that can help me with this?