错误:13 内部:收到由内部客户端错误触发的代码 2 的 RST_STREAM:协议错误

问题描述 投票:0回答:1

我尝试通过 nginx 服务器从 api 用户连接到我的 hyperledger Fabric 网络。我的 *.conf 文件中有下一个设置:

  • 第一个文件
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/;

    }
 }

当我尝试执行从 k8s clusterer(k8s 集群中存储了我的 node.js api 和我的 hf 网络)到 nginx 的连接请求时,我收到以下输出:

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)

我的访问日志:

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

我的错误日志:

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

nginx hyperledger-fabric
1个回答
0
投票

我收到了同样的错误,不能保证这是同样的问题,因为我不使用 nginx 作为代理。我的设置是 - nodejs 和

fabric-network
库,并使用
fabric-samples/test-network
在本地运行它。我的问题是我使用的
connection_file
不再与您在启动测试网络时获得的组织连接文件相匹配。

因此,如果您的设置与我相同,请将

fabric-samples/test-network/organizations/peerOrganizations/org{something}.example.com/connection-org{somemthing}.json
文件复制到您用于设置节点连接的连接文件(将在后端根目录中的
config.json
文件中定义)。基本上,当尝试连接到对等节点时,您的 TLS 验证失败。您还可以查看来自对等节点的日志以获取更多信息。

© www.soinside.com 2019 - 2024. All rights reserved.