Created
April 10, 2020 01:56
-
-
Save richardkiene/1fa8daba9074868704676e4fe6b8fc5a to your computer and use it in GitHub Desktop.
Example grpc failure with node
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var fs = require('fs'); | |
var protoLoader = require('@grpc/proto-loader'); | |
var grpc = require('grpc'); | |
var protoFile = 'account.proto'; | |
var options = { keepCase: true, longs: String, enums: String, defaults: true, oneofs: true }; | |
var pkgDef = protoLoader.loadSync(protoFile, options); | |
var account = grpc.loadPackageDefinition(pkgDef).account; | |
var cert = fs.readFileSync('cert.pem'); | |
var key = fs.readFileSync('key.pem'); | |
var keyCertPair = [{private_key:key, cert_chain:cert}]; | |
var client = new account.Accounts('dev01:5001', grpc.credentials.createSsl(null, key, cert, function () {})); | |
//var client = new account.Accounts('dev01:5001', grpc.credentials.createSsl()); | |
client.Authenticate({email: 'test@example.com', password: 'password', ipAddress: "127.0.0.1", userAgent:'grpctesting'}, function(err, response) { | |
console.log('Error: ', err); | |
console.log('Response: ', response); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
E0409 18:47:45.398419000 4577918400 ssl_transport_security.cc:1245] Handshake failed with fatal error SSL_ERROR_SSL: error:1416F086:SSL routines:tls_process_server_certificate:certificate verify failed. | |
Error: Error: 14 UNAVAILABLE: failed to connect to all addresses | |
at Object.exports.createStatusError (.../node_modules/grpc/src/common.js:91:15) | |
at Object.onReceiveStatus (.../node_modules/grpc/src/client_interceptors.js:1209:28) | |
at InterceptingListener._callNext (.../node_modules/grpc/src/client_interceptors.js:568:42) | |
at InterceptingListener.onReceiveStatus (.../node_modules/grpc/src/client_interceptors.js:618:8) | |
at callback (.../node_modules/grpc/src/client_interceptors.js:847:24) { | |
code: 14, | |
metadata: Metadata { _internal_repr: {}, flags: 0 }, | |
details: 'failed to connect to all addresses' | |
} | |
Response: undefined |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment