Error invoking chaincode using Node.js SDK [TypeError: Cannot read property 'getConnectivityState' of undefined]

让人想犯罪 __ 提交于 2019-12-07 00:46:27

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

Kataus V

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.

Dikshika Jain

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

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

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.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!