<p>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 <strong>fabric-ca-client</strong> library with <strong>nodejs</strong> 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.</p>
<p>All the all the pods are communicating with each other using these services in kubernetes</p>
<p>this is how my connection profile looks</p>
<pre><code>&quot;certificateAuthorities&quot;: {
    &quot;ca-org2&quot;: {
        &quot;url&quot;: &quot;https://ca-org2:8054&quot;,
        &quot;caName&quot;: &quot;ca-org2&quot;,
        &quot;tlsCACerts&quot;: {
            &quot;pem&quot;: [&quot;-----BEGIN CERTIFICATE-----\nMIICBjCCAa2gAwIBAgIUHwBYatG6KhezYWHxdGgYGqs77PIwCgYIKoZIzj0EAwIw\nYDELMAkGA1UEBhMCVUsxEjAQBgNVBAgTCUhhbXBzaGlyZTEQMA4GA1UEBxMHSHVy\nc2xleTEZMBcGA1UEChMQb3JnMi5leGFtcGxlLmNvbTEQMA4GA1UEAxMHY2Etb3Jn\nMjAeFw0yMTAzMjAxMDI4MDBaFw0zNjAzMTYxMDI4MDBaMGAxCzAJBgNVBAYTAlVL\nMRIwEAYDVQQIEwlIYW1wc2hpcmUxEDAOBgNVBAcTB0h1cnNsZXkxGTAXBgNVBAoT\nEG9yZzIuZXhhbXBsZS5jb20xEDAOBgNVBAMTB2NhLW9yZzIwWTATBgcqhkjOPQIB\nBggqhkjOPQMBBwNCAAQUIABkRhfPdwoy2QrCY3oh8ZuzP5OprZJawVXO2ojid3j4\nC9W4l46QXR5J7iG5MLczguPZWB9dZWygRQdUQeoAo0UwQzAOBgNVHQ8BAf8EBAMC\nAQYwEgYDVR0TAQH/BAgwBgEB/wIBATAdBgNVHQ4EFgQURx/h3nkH0fq+3TlRPnQW\nWTHbR7YwCgYIKoZIzj0EAwIDRwAwRAIgCF+vcLFERb+VHa6Att0rh5yhpMd0bHEn\nmkNo0YfKuX4CICodtpp6AKtNWXreskaN+kRMH8eDmwvxkhvTK68ejv8U\n-----END CERTIFICATE-----\n&quot;]
        },
        &quot;httpOptions&quot;: {
            &quot;verify&quot;: false
        }
    }
}
</code></pre>
<p><a href="https://i.stack.imgur.com/lmKGW.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/lmKGW.png" alt="nodejs application logs" /></a></p>
<p><a href="https://i.stack.imgur.com/drMFH.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/drMFH.png" alt="ca server logs" /></a></p>

<p>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 <code>connection timeout</code> and <code>request-timeout</code>. The default value of timeouts is 3s and I increased it to 30s and it started working. The default configuration can be found <a href="https://github.com/hyperledger/fabric-sdk-node/blob/main/fabric-ca-client/config/default.json" rel="nofollow noreferrer">here</a></p>
<pre><code>{
    &quot;request-timeout&quot; : 3000,
    &quot;tcert-batch-size&quot; : 10,
    &quot;crypto-hash-algo&quot;: &quot;SHA2&quot;,
    &quot;crypto-keysize&quot;: 256,
    &quot;crypto-hsm&quot;: false,
    &quot;connection-timeout&quot;: 3000
}
</code></pre>
<p>we can update the timeout values from source code of the fabric-ca-client library or simply can use the methods of <code>fabric-common</code> library to update the these configuration values like this.</p>
<pre><code>const { Utils: utils } = require('fabric-common');
const path=require('path');
let config=utils.getConfig()
config.file(path.resolve(__dirname,'config.json'))
</code></pre>
<p>And here is our modified configuration file <code>config.json</code></p>
<pre><code>  {
  &quot;request-timeout&quot; : 30000,
  &quot;tcert-batch-size&quot; : 10,
  &quot;crypto-hash-algo&quot;: &quot;SHA2&quot;,
  &quot;crypto-keysize&quot;: 256,
  &quot;crypto-hsm&quot;: false,
  &quot;connection-timeout&quot;: 30000
  }
</code></pre>
