Specify minimal supported Node.js version or support older ones like 14
puzpuzpuz opened this issue · 0 comments
puzpuzpuz commented
Scenario:
- Create a QuestDB Cloud instance
- Run generated ILP ingestion script for Node.js with Node.js 14, e.g. v14.17.6
- Observe the following error:
$ node insert-client.js
Successfully connected to <host>:<port>
Authenticating with <host>:<port>
(node:392696) UnhandledPromiseRejectionWarning: TypeError [ERR_INVALID_ARG_TYPE]: The "key.key" property must be of type string or an instance of Buffer, TypedArray, or DataView. Received an instance of Object
at prepareAsymmetricKey (internal/crypto/keys.js:288:13)
at Object.createPrivateKey (internal/crypto/keys.js:349:5)
at authenticate (/home/puzpuzpuz/projects/node-experiments/node_modules/@questdb/nodejs-client/src/sender.js:387:40)
at TLSSocket.<anonymous> (/home/puzpuzpuz/projects/node-experiments/node_modules/@questdb/nodejs-client/src/sender.js:133:43)
at TLSSocket.emit (events.js:400:28)
at addChunk (internal/streams/readable.js:290:12)
at readableAddChunk (internal/streams/readable.js:265:9)
at TLSSocket.Readable.push (internal/streams/readable.js:204:10)
at TLSWrap.onStreamRead (internal/stream_base_commons.js:188:23)
(Use `node --trace-warnings ...` to show where the warning was created)
(node:392696) 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(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 2)
(node:392696) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
The reason is that crypto.createPrivateKey(key)
supports JWK object starting from v15.12.0: https://nodejs.org/api/crypto.html#cryptocreateprivatekeykey