How to fix the [ERROR] Helper - Failed to get registered user: Jim with error: TypeError: client.loadFromConfig is not a function - hyperledger-fabric

to solve the bug when i running hyperledger fabrics , balance
transfer by using the command in the bash script using the commands
./runApp.sh ./tesAPIs.sh
------------------------------------------------------------------------------ then getting the error: [2019-04-04 16:20:42.432] [ERROR] Helper -
Failed to get registered user: Jim with error: TypeError:
client.loadFromConfig is not a function [2019-04-04 16:20:42.432]
[ERROR] Helper - Failed to get registered user: Jim with error:
TypeError: client.loadFromConfig is not a function
---------------------------------------------------------------------------- tried with the hyperledger-fabric version 1.2.0 and
hyperledger-fabric version 1.4.0 , both times getting the same error
when i am running ./runApp.sh ./tesAPIs.sh when i am running
from hyperledger fabric from balance transfer. [ERROR] Helper -
Failed to get registered user: Jim with error: TypeError:
client.loadFromConfig is not a function this error should be
removed.

I've managed to fix this bug.
The thing is that in file helper.js in app folder, on the line 44 await is missing.
You can look at this line
let client = hfc.loadFromConfig(hfc.getConfigSetting('network'+config));
And when you log client you will see that there is a promise.
So you need just to add await before hfc.loadFromConfig and client will be a valid object with loadFromConfig function.

Related

After writing my smart contract i'm trying to install the chaincode on the default network but I keep receiving an error

I installed minifabric and wrote my own chaincode but when i try to install it on the default channel i get the following error:
non-zero reuturn code
Error: No such container: mysite
My smart contract is the following path: ~/mywork/vars/chaincode/mycc/go

Error: Failed to connect before the deadline URL:grpc://localhost:7051

:~/Documents/test/education/LFS171x/fabric-material/tuna-app/$ node query.js
Store path:/home/*******/Documents/test/education/LFS171x/fabric-material/tuna-app/hfc-key-store
Successfully loaded user1 from persistence
2020-02-11T05:56:10.423Z - error: [Remote.js]: Error: Failed to connect before the deadline URL:grpc://localhost:7051
Query has completed, checking results
error from query = Error: Failed to connect before the deadline URL:grpc://localhost:7051
at checkState (/home/******/Documents/test/education/LFS171x/fabric-material/tuna-app/node_modules/fabric-client/node_modules/grpc/src/client.js:883:16) {
connectFailed: true
}
Im experimenting Hyperledger Fabric, using this link for reference,
Successfully registered admin and user, using registerAdmin.js and registerUser.js.
I am currently facing this error after running node query.js.
I need help troubleshooting this error,
Error: Failed to connect before the deadline
URL:grpc://localhost:7051.
Platform: Ubuntu 18.04,
Experimenting hyperledger fabric using Local Environment.
Thanks in advance.

Dialogflow NodeJS library issue

I'm working on a dialogflow POC where I'm trying to invoke the v2 API provided by DialogFlow. While trying the NodeJS code example provided here, I'm getting the below error
{ Error: EHOSTUNREACH undefined: Getting metadata from plugin failed with error: request to https://www.googleapis.com/oauth2/v4/token failed, reason: connect EHOSTUNREACH 0.0.38.172:80 - Local (192.168.0.103:51468)
at Object.callErrorFromStatus (/Users/devuser/Development/workspaces/df-poc/node_modules/#grpc/grpc-js/build/src/call.js:30:26)
at Http2CallStream.call.on (/Users/devuser/Development/workspaces/df-poc/node_modules/#grpc/grpc-js/build/src/client.js:96:33)
at Http2CallStream.emit (events.js:203:15)
at process.nextTick (/Users/devuser/Development/workspaces/df-poc/node_modules/#grpc/grpc-js/build/src/call-stream.js:75:22)
at process._tickCallback (internal/process/next_tick.js:61:11)
code: 'EHOSTUNREACH',
details:
'Getting metadata from plugin failed with error: request to https://www.googleapis.com/oauth2/v4/token failed, reason: connect EHOSTUNREACH 0.0.38.172:80 - Local (192.168.0.103:51468)',
metadata: Metadata { internalRepr: Map {}, options: {} } }
I have imported GOOGLE_APPLICATION_CREDENTIALS and point the environment variable to the credentials. The invocation works fine if I try the REST API route with the Authorization header.
Kindly let me know if there is something which I'm missing here.
This means EHOST (the remote host of the files you are requesting) are unreachable. They are either down, or your computer cannot access them due to some other restriction, such as location, which can be solved with a VPN.

Error Promise is rejected: when running balance-transfer (hyperledger) with nodejs

I am following the steps to run the blockchain code from balance-transfer in the sample codes provided by hyperledger.
https://github.com/hyperledger/fabric-samples/tree/release/balance-transfer.
Things work smoothly when I run it with golang but I get the following error when I run it with node.js.
error: [client-utils.js]: sendPeersProposal - Promise is rejected: Error: error starting container: Failed to generate platform-specific docker build: Error returned from build: 254 "npm WARN example_cc#1.0.0 No repository field.
The error occurs when the chaincode is instantiated on the channel.
I am using node v8.6.0 and npm v5.3.0.
Any idea what is going on?
Thanks in advance.
It turns out the code written in node.js has been removed in their latest release. I guess there was a problem with it.

Hyperledger Fabric Errror : Query - Error: chaincode error (status: 500, message: Failed to get block number 1, error Entry not found in index

I am trying to execute balance-transfer application that ship in fabric-samples of hyperledger. Source code path git clone https://github.com/hyperledger/fabric-samples.git
All steps executed as below
Channel created Joined channel on Org1
Joined channel on Org2
Successfully Installed chaincode on organization org1
Successfully Installed chaincode on organization org2
but instantiate of chaincode operation is failing on peers.
Can anyone please help me to solve this issue. I am struggling from last one week. I am using docker container on ubuntu v16.
Error Log:
[2017-10-02 05:11:11.374] [DEBUG] Helper - [crypto_ecdsa_aes]: ecdsa signature: Signature {<br/>
r: <BN: 4824699f0a1d1a0fc696df545fb3379dffc6b46124619f53672359a6755bc7ff>,<br/>
s: <BN: 49fc91b2a7800eff5396053d4d8ff2683167a9e3f52ccc43228143f9b5741168>,<br/>
recoveryParam: 0 }
error: [client-utils.js]: sendPeersProposal - Promise is rejected: Error: chaincode error (status: 500, message: Failed to get block number 1, error Entry not found in index)<br/>
at /home/02102017/fabric-samples/balance-transfer/node_modules/grpc/src/node/src/client.js:554:15<br/>
error: [Channel.js]: Failed Query block. Error: Error: chaincode error (status: 500, message: Failed to get block number 1, error Entry not found in index)<br/>
at /home/02102017/fabric-samples/balance-transfer/node_modules/grpc/src/node/src/client.js:554:15<br/>
[2017-10-02 05:11:11.472] [ERROR] Query - Error: chaincode error (status: 500, message: Failed to get block number 1, error Entry not found in index)<br/>
at /home/02102017/fabric-samples/balance-transfer/node_modules/grpc/src/node/src/client.js:554:15<br/>
Isssue resolve after increasing request-timeout in file fabric-samples-master/balance-transfer/node_modules/fabric-client/config/default.json
There is no need to overwrite fabric-samples-master/balance-transfer/node_modules/fabric-client/config/default.json. There is a open issue on JIRA https://jira.hyperledger.org/browse/FABN-884 regarding request timeout.
and For now as a workaround you could set it globally before making the call.
const temp = client.getConfigSetting('request-timeout');
client.setConfigSetting('request-timeout', 60000);
... make your call ...
client.setConfigSetting('request-timeout', temp);
Hope it will work for you.

Resources