That can be solved by bumping the Cosmos DB client to the latest version like that in package.json:
"@azure/cosmos": "^3.17.3",
That would require a small change in the db.js file:
client = new CosmosClient({ endpoint, key: masterKey });
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Hi, I have setup Azure cosmos db and written a simple conn.ts script to create document in cosmos db. I am using Node 18.14.2 which has built-in openssl 3.0.8+quic in it. I am getting an error as shown below:
**The same code works fine with Node version v16.19.1 which has openssl 1.1.1t+quic version.
**
Is Azure server not compatible for Node 18 openssl 3 version? Or should I need to change anything in my conn.ts to make the connection work?
ERROR :
$ npx ts-node conn.ts
v18.14.2
(node:12796) Warning: Accessing non-existent property 'zero' of module exports inside circular dependency
(Use node --trace-warnings ...
to show where the warning was created)
Failed to insert document: Error: write EPROTO A8590000:error:0A00014D:SSL routines:tls_process_key_exchange:legacy sigalg disallowed or unsupported:c:\ws\deps\openssl\openssl\ssl\statem\statem_clnt.c:2263:
at WriteWrap.onWriteComplete [as oncomplete] (node:internal/stream_base_commons:94:16) {
errno: -4046,
code: 'EPROTO',
syscall: 'write',
isTimedout: false,
duration: 110
}
Please find the contents of conn.ts:
import * as DocumentDB from 'documentdb';
console.log(process.version);
console.log(process.versions.openssl);
// Set up the Cosmos DB client
const endpoint = ****;
const key = ****;
const databaseId = ****;
const collectionId = ****;
const client = new DocumentDB.DocumentClient(endpoint, {
masterKey: key,
});
// Define a sample document to insert
const document = {
id: 'hello-world',
message: 'Hello, World!',
};
// Insert the document
client.createDocument(
dbs/${databaseId}/colls/${collectionId}
,
document,
(error, createdDocument) => {
if (error) {
console.error('Failed to insert document:', error);
} else {
console.log('Document inserted successfully:', createdDocument);
}
}
);
That can be solved by bumping the Cosmos DB client to the latest version like that in package.json:
"@azure/cosmos": "^3.17.3",
That would require a small change in the db.js file:
client = new CosmosClient({ endpoint, key: masterKey });