Error invoking chaincode using Node.js SDK [TypeEr

2019-06-01 09:43发布

Failed to invoke successfully :: TypeError: Cannot read property 'getConnectivityState' of undefined /opt/share/hyperledger/node_modules/fabric-client/lib/EventHub.js:355 if(self._stream) state = self.stream.call.channel.getConnectivityState(); ^

TypeError: Cannot read property 'getConnectivityState' of undefined
    at ClientDuplexStream.<anonymous> (/opt/share/hyperledger/node_modules/fabric-client/lib/EventHub.js:355:56)
    at emitOne (events.js:116:13)
    at ClientDuplexStream.emit (events.js:211:7)
    at ClientDuplexStream._emitStatusIfDone (/opt/share/hyperledger/node_modules/grpc/src/client.js:236:12)
    at ClientDuplexStream._readsDone (/opt/share/hyperledger/node_modules/grpc/src/client.js:201:8)
    at /opt/share/hyperledger/node_modules/grpc/src/client_interceptors.js:705:15

I am using latest version of pre-requisites as mentioned in below link:

http://hyperledger-fabric.readthedocs.io/en/release-1.1/getting_started.html#install-prerequisites

Can anybody tell me where am i going wrong?

6条回答
兄弟一词,经得起流年.
2楼-- · 2019-06-01 10:15

Yes, this is due to a new version of grpc released 3 days ago (v1.11.0). The version is controlled by fabric-client and it takes the latest available. You need to delete the grpc module and reinstall it with npm install grpc@1.9.1. This will fix the issue. Going forward you may need to have grpc fixed at 1.9.1 in your package.json until Hyperledger resolve this issue.

Reference: https://chat.hyperledger.org/channel/general?msg=FME6aDfnfMexWTm6g

查看更多
Deceive 欺骗
3楼-- · 2019-06-01 10:23

Faced the same issue while building the web docker edit package.json add the line "dependencies": { "grpc" : "1.9.1",

build the docker again issue the docker compose agin ! it works

查看更多
爱情/是我丢掉的垃圾
4楼-- · 2019-06-01 10:28

I commented these lines in EventHub.js. It's required only for state log. For example:

<br/>
<i>         var state = -1;<br/>
            //if(self._stream) state = self._stream.call.channel_.getConnectivityState();<br/>
            logger.debug('on.data - grpc stream state :%s',state);<br/>
</i><br/><br/>

it works fine now.

查看更多
smile是对你的礼貌
5楼-- · 2019-06-01 10:33

I was trying to connect the composer bna to IBM blockchain, and I tried out installing grpc 1.9.1.. and even 1.10.1.. I tried out like everything, and the only thing that worked was doing as Kataus suggested, I commented out the lines relate to the getConnectivity state, and it finally connected to the IBM blockchain network I had.

查看更多
我欲成王,谁敢阻挡
6楼-- · 2019-06-01 10:34

Thank you Anjy, updating grpc module worked fine.

查看更多
我想做一个坏孩纸
7楼-- · 2019-06-01 10:35

I'm still getting below error after commenting the line in EventHub.js

Failed to invoke successfully :: TypeError: Cannot read property 'getConnectivityState' of undefined

Previous detailed error:

TypeError: Cannot read property 'getConnectivityState' of undefined at ClientDuplexStream. (/fabric-samples/fabcar/node_modules/fabric-client/lib/EventHub.js:308:56) at emitOne (events.js:116:13) at ClientDuplexStream.emit (events.js:211:7) at addChunk (_stream_readable.js:263:12) at readableAddChunk (_stream_readable.js:250:11) at ClientDuplexStream.Readable.push (_stream_readable.js:208:10) at Object.onReceiveMessage (/fabric-samples/fabcar/node_modules/grpc/src/client_interceptors.js:1302:19) at InterceptingListener.recvMessageWithContext (/fabric-samples/fabcar/node_modules/grpc/src/client_interceptors.js:629:19) at /fabric-samples/fabcar/node_modules/grpc/src/client_interceptors.js:728:14

查看更多
登录 后发表回答