3

I am running my fabric network on kubernetes and I have setup ca servers for all the organisations. I am able to register and enroll the user from the cli but when i am using the fabric-ca-client library with nodejs to register and enroll the users. I am facing the CONNECTION Timeout issue, also at the same time if I look at the logs of my ca-server it show that is able to process the request. Edit1: I am using the same code provided in fabric-sample to register and enroll the users.

All the all the pods are communicating with each other using these services in kubernetes

this is how my connection profile looks

"certificateAuthorities": {
    "ca-org2": {
        "url": "https://ca-org2:8054",
        "caName": "ca-org2",
        "tlsCACerts": {
            "pem": ["-----BEGIN CERTIFICATE-----\nMIICBjCCAa2gAwIBAgIUHwBYatG6KhezYWHxdGgYGqs77PIwCgYIKoZIzj0EAwIw\nYDELMAkGA1UEBhMCVUsxEjAQBgNVBAgTCUhhbXBzaGlyZTEQMA4GA1UEBxMHSHVy\nc2xleTEZMBcGA1UEChMQb3JnMi5leGFtcGxlLmNvbTEQMA4GA1UEAxMHY2Etb3Jn\nMjAeFw0yMTAzMjAxMDI4MDBaFw0zNjAzMTYxMDI4MDBaMGAxCzAJBgNVBAYTAlVL\nMRIwEAYDVQQIEwlIYW1wc2hpcmUxEDAOBgNVBAcTB0h1cnNsZXkxGTAXBgNVBAoT\nEG9yZzIuZXhhbXBsZS5jb20xEDAOBgNVBAMTB2NhLW9yZzIwWTATBgcqhkjOPQIB\nBggqhkjOPQMBBwNCAAQUIABkRhfPdwoy2QrCY3oh8ZuzP5OprZJawVXO2ojid3j4\nC9W4l46QXR5J7iG5MLczguPZWB9dZWygRQdUQeoAo0UwQzAOBgNVHQ8BAf8EBAMC\nAQYwEgYDVR0TAQH/BAgwBgEB/wIBATAdBgNVHQ4EFgQURx/h3nkH0fq+3TlRPnQW\nWTHbR7YwCgYIKoZIzj0EAwIDRwAwRAIgCF+vcLFERb+VHa6Att0rh5yhpMd0bHEn\nmkNo0YfKuX4CICodtpp6AKtNWXreskaN+kRMH8eDmwvxkhvTK68ejv8U\n-----END CERTIFICATE-----\n"]
        },
        "httpOptions": {
            "verify": false
        }
    }
}

nodejs application logs

ca server logs

Aditya Joshi
  • 529
  • 4
  • 13
  • What is the URL you re using to connect to the server? Is this server accessible from the device you are trying to run the provisioning on? Seems like some firewall is dropping the connection, or the address is not setup correctly. – Matt Clark Mar 20 '21 at 19:14
  • yes, requests from nodejs app is passing successfully to the CA server. Since all the components are running within the kubernetes cluster, i am using services to access my deployment/pods – Aditya Joshi Mar 20 '21 at 19:15
  • Your CA logs are normal. Are you sure these logs are appended when you call the register function? – harisato_vn Apr 08 '21 at 03:11
  • yes, we can verify it using the logs timestamp – Aditya Joshi Apr 08 '21 at 07:01

1 Answers1

1

I found the solution to this issue. The issue was related to the connection timeout, my CA Server was receving the requests and able to process them also but due to the short timeout the request was being cancelled. The solution was to increase the connection timeout and request-timeout. The default value of timeouts is 3s and I increased it to 30s and it started working. The default configuration can be found here

{
    "request-timeout" : 3000,
    "tcert-batch-size" : 10,
    "crypto-hash-algo": "SHA2",
    "crypto-keysize": 256,
    "crypto-hsm": false,
    "connection-timeout": 3000
}

we can update the timeout values from source code of the fabric-ca-client library or simply can use the methods of fabric-common library to update the these configuration values like this.

const { Utils: utils } = require('fabric-common');
const path=require('path');
let config=utils.getConfig()
config.file(path.resolve(__dirname,'config.json'))

And here is our modified configuration file config.json

  {
  "request-timeout" : 30000,
  "tcert-batch-size" : 10,
  "crypto-hash-algo": "SHA2",
  "crypto-keysize": 256,
  "crypto-hsm": false,
  "connection-timeout": 30000
  }
Aditya Joshi
  • 529
  • 4
  • 13