Ivan
Ivan

Reputation: 313

Error: 13 INTERNAL: Received RST_STREAM with code 2 triggered by internal client error: Protocol error

I try to connect from api user to my hyperledger fabric network via nginx server. I have next settings in my *.conf files:

upstream rca-org1 {
    server XXXX:7054;
}

upstream couchdb {
    server XXXX:5984;
}


server {
    
    listen XXXX:80 default_server;

    listen [::]:80;

    server_name XXXX;

    access_log path/to/nginx/access.log;

location / {

    root /app/build;

    index index.html;

    try_files $uri /index.html;

}

location /api {
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header X-Forwarded-Proto $scheme;
    proxy_set_header Host $http_host;
    proxy_redirect off;
    proxy_pass http://rca-org1;
}

location /wallet {
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header X-Forwarded-Proto $scheme;
    proxy_set_header Host $http_host;
    proxy_redirect off;
    proxy_pass http://couchdb;
}
upstream network {
    server XXXX:7051;
}

server {

    listen 80 http2;

    listen [::]:80;

    server_name XXXX;

    access_log /path/to/nginx/access.log;

location /channels {
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header X-Forwarded-Proto $scheme;
    proxy_set_header Host $http_host;
    proxy_redirect off;
    grpc_pass grpc://network;

}

    location ~/(static|media)/ {

        root /app/build/;

    }
 }

When I try to execute connect request from k8s claster (there are store my node.js api and my hf network in k8s cluster) to nginx, I receive this output:

Error: 13 INTERNAL: Received RST_STREAM with code 2 triggered by internal client error: Protocol error        at Object.callErrorFromStatus (/path/to/node_modules/fabric-protos/node_modules/@grpc/grpc-js/build/src/call.js:31:19)        at Object.onReceiveStatus (/path/to/node_modules/fabric-protos/node_modules/@grpc/grpc-js/build/src/client.js:190:52)        at Object.onReceiveStatus (/path/to/node_modules/fabric-protos/node_modules/@grpc/grpc-js/build/src/client-interceptors.js:365:141)        at Object.onReceiveStatus (/path/to/node_modules/fabric-protos/node_modules/@grpc/grpc-js/build/src/client-interceptors.js:328:181)        at /path/to/node_modules/fabric-protos/node_modules/@grpc/grpc-js/build/src/call-stream.js:188:78        at processTicksAndRejections (internal/process/task_queues.js:77:11)    for call at        at ServiceClientImpl.makeUnaryRequest (/path/to/node_modules/fabric-protos/node_modules/@grpc/grpc-js/build/src/client.js:160:30)        at ServiceClientImpl.<anonymous> (/path/to/node_modules/fabric-protos/node_modules/@grpc/grpc-js/build/src/make-client.js:105:19)        at /path/to/node_modules/fabric-common/lib/Discoverer.js:73:17        at new Promise (<anonymous>)        at Discoverer.sendDiscovery (/path/to/node_modules/fabric-common/lib/Discoverer.js:54:10)        at DiscoveryService.send (/path/to/node_modules/fabric-common/lib/DiscoveryService.js:318:30)        at processTicksAndRejections (internal/process/task_queues.js:95:5)        at async NetworkImpl._initializeInternalChannel (/path/to/node_modules/fabric-network/lib/network.js:300:13)        at async NetworkImpl._initialize (/path/to/node_modules/fabric-network/lib/network.js:250:9)        at async Gateway.getNetwork (/path/to/node_modules/fabric-network/lib/gateway.js:350:9)        at async fabricConnectorForUser (/path/to/custom_policies/fabricConnectorForUser/index.js:28:23)

My access.log:

10.39.22.45 - - [29/Sep/2022:16:57:52 +0300] "PRI * HTTP/2.0" 400 157 "-" "-"

My error.log:

2022/09/29 16:57:21 [warn] 5810#5810: conflicting server name "XXXX" on [::]:80, ignored

Upvotes: 4

Views: 12803

Answers (2)

Abdullah Ismail
Abdullah Ismail

Reputation: 465

In my case, I mistakenly configured my application to connect to localhost:3001 instead of the correct port localhost:50051 as specified in my gRPC configuration.

Upvotes: 0

Nate Nolan
Nate Nolan

Reputation: 31

I received the same error, can't guarantee it was the same exact issue because I don't use nginx as a proxy. My setup was - nodejs and the fabric-network library and running it locally with the fabric-samples/test-network. My issue was the connection_file I was using no longer matched the organization connection file you get when spinning up a test network.

So if you have the same setup as I did, copy the fabric-samples/test-network/organizations/peerOrganizations/org{something}.example.com/connection-org{somemthing}.json file to the connection file you're using to setup your node connection (would be defined in the config.json file in the root of your backend). Basically, your TLS validation is failing when trying to connect to your peer node. You can also look at logs coming from the peer node for more information.

Upvotes: 0

Related Questions