Skip to content

Instantly share code, notes, and snippets.

@bergundy
Created May 11, 2021 07:51
Show Gist options
  • Save bergundy/32f181f056760928cf934d2d4f695e33 to your computer and use it in GitHub Desktop.
Save bergundy/32f181f056760928cf934d2d4f695e33 to your computer and use it in GitHub Desktop.
grpc-js mTLS connection failure
const path = require('path');
const fs = require('fs');
const grpc = require('@grpc/grpc-js'); // No error if replaced with grpc
const Client = grpc.makeGenericClientConstructor({}, 'WorkflowService', {});
const credentials = grpc.credentials.createSsl(
fs.readFileSync(path.join(__dirname, 'certs/cluster/ca/server-intermediate-ca.pem')),
fs.readFileSync(path.join(__dirname, 'certs/client/development/client-development-namespace.key')),
fs.readFileSync(path.join(__dirname, 'certs/client/development/client-development-namespace.pem'))
);
const client = new Client('localhost:7233', credentials, {
'grpc.ssl_target_name_override': 'development.cluster-x.contoso.com',
});
client.waitForReady(Date.now() + 5000, (err) => {
console.log('connected?', { err });
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment