Azure/azure-cosmos-js

Getting self signed certificate error with local cosmos db emulator

Closed this issue · 2 comments

Even if I set connectionPolicy.disableSSLVerification = true, am getting self signed certificate error with local cosmos db emulator.
@azure/cosmos npm package version is 3.0.4

@arulselvam Thanks for the bug report. I'll investigate this but as a workaround try putting this at the top of your entry point file: process.env["NODE_TLS_REJECT_UNAUTHORIZED"] = 0;

I'm going to remove this option as it doesn't currently work. There are now two ways to do this:

  1. Pass a custom agent
    const client = new CosmosClient({
      endpoint,
      key,
      agent: new https.Agent({
        rejectUnauthorized: false
      })
    });
  1. Globally disable SSL Checks:
    process.env.NODE_TLS_REJECT_UNAUTHORIZED = "0";
    const client = new CosmosClient({
      endpoint,
      key
    });