Data size limit. Error: Received message larger than max - node.js

I am running a node script which connects to the business network and adds assets to the network.
I get the below error.
Error: Error trying invoke business network. Error: No valid responses from any peers.
Response from attempted peer comms was an error: Error: Received message larger than max (5153800 vs. 4194304)
at _initializeChannel.then.then.then.then.catch (/home/sneha/node-app-v1/node_modules/composer-connector-hlfv1/lib/hlfconnection.js:916:34)
at <anonymous>
I followed this solved issue: https://jira.hyperledger.org/browse/FAB-3301
and changed remote.js file in respective node modules [ composer-playground,composer-client,composer-admin,composer-common etc.. ]
Even after the changes, I can't add the asset through the node script. It throws the same error.
If I add the asset through composer playground it successfully adds the asset but then I can't access the network [ in composer playground ] it throws this error
Error: No connection found with ID 2db7d182-8856-44d5-a9d8-5f7178726423
How can I solve both errors?
How can I set the limit to infinite?
I am using:
Node version: v8.9.4
Composer version: v0.16.5

To change grpc message limits requires you to create/update your connection profile. See https://hyperledger.github.io/composer/reference/connectionprofile
for information about connection profiles.
A no connection profile with id found usually implies you have restarted playground, but not restarted your interaction with playground. Would suggest closing the playground tab and creating new tab to use playground in.

Related

Why can't I commit transactions with Caliper to Hyperledger Fabric?

I've got Caliper configured as a subtree of my custom Fabric blockchain. I have it configured correctly in order to connect the network and am running a small set of tests at the moment. The arguments I'm providing are absolutely correct in terms of the custom chaincode being run, but whenever I try to create a transaction via Caliper I get the error:
Failed to perform submit transaction [CreateAsset] using arguments [<ARGS>], with error: TypeError: Cannot read property 'status' of undefined
Anybody encountered this before with Caliper V0.4.2? It's interfacing with a Fabric 2.3.3 instance on local machine via Kubernetes, with the latest SDK bound.
The error occurs on line 237 of transactions.js inside the node_module fabric-network, where there is a strict property comparison on a commit object.
Also it's worth noting that the querying part of my test rounds is yielding expected results... none of those assets get created due to the error thrown, and when querying for a given asset an error like so occurs:
Failed to perform query transaction [ReadAsset] using arguments [<ID>], with error: Error: error in simulation: transaction returned with failure: Error: The asset <ID> does not exist
The closest thing I've been able to find is this ~2 year old issue which isn't exactly what I'm facing but it's the same sort of error at least... any help or pointers would be greatly appreciated because I'm struggling to glean useful information. (Link: https://github.com/hyperledger/caliper/issues/727)
The issue was due to the host names being converted to localhost when you want to work anything except a network running locally via docker. You need to launch caliper with the following extra option
--caliper-fabric-gateway-localhost false

Problem with Wallet Creation, signature error

I want to create a wallet for new rest api server, but whenever I call code to generate new Wallet I'm getting error like
"Decoding SignatureHeader failed: Error illegal buffer ..."
Here is screen shot of my code, it is taken from virtual machine
I'm using hyperledger fabric 2.2 and run under the fabric-samples/test-network
I was clone this HyperledgerFabroc
Here is also print screen of the error:
I would appreciate if someone can navigate me how to manage successfully to create a wallet ?
Your error looks to be occurring within a chaincode transaction function. You should not be using the client SDK to do a transaction invocation from within chaincode. Instead look to use the invokeChaincode function on the stub:
https://hyperledger.github.io/fabric-chaincode-node/release-1.4/api/fabric-shim.ChaincodeStub.html#invokeChaincode

Timeout expired while querying large data on Hyperledger Fabric 1.4.1

I am using Hyperledger Fabric 1.4.1, with Kafka ordering service, Couch DB as stateDB, Java chaincode and Java SDK.
I experience timeout expired when I try to send large data to the channel and then query it back.
The data size of the transaction I sent is 512KB, and I can query it from peers.
I tried sending it 7 times with the same id, and I can get all 7 histories with shim function getHistoryForKey. But when I sent it 8 times with the same id, getHistoryForKey failed.
The error message is shown below (from peers):
Error: endorsement failure during query. response: status:500 message:"failed to execute transaction fdfbc5b72efd688136c777f5b114a3cedc62339e42f6c39a27e86ca11b8e3d14: error sending: timeout expired while executing transaction"
I have tried to expand the timeout with following options and their combinations in peer and client:
CORE_CHAINCODE_EXECUTETIMEOUT="120s"
CORE_LEDGER_STATE_COUCHDBCONFIG_REQUESTTIMEOUT="120s"
# (seems this setting is not for Hyperledger Fabric)
CORE_PEER_GRPCOPTIONS_REQUESET_TIMEOUT="120s"
But they didn't help in my case.
I also noticed that the 7 copies of testing data are about 3.5MB, and I tried to query 4MB data (which is about 8 copies) from a peer but failed.
When we check the chaincode runtime docker, we see the following error message:
SEVERE: An error occured on the chaincode stream. Shutting down the chaincode stream.
io.grpc.StatusRuntimeException: RESOURCE_EXHAUSTED:
io.grpc.netty.NettyClientTransport$3: Frame size 6294852 exceeds maximum: 4194304.
It seems like there is a grpc limitation on running the java chaincode docker.
We tested with go chaincode, we do not experience the same issue.
We managed to fix that by overriding the ChaincodeBase class
ManagedChannelBuilder<?> newChannelBuilder() throws IOException {
final NettyChannelBuilder builder = NettyChannelBuilder.forAddress(host, port);
logger.info("Configuring channel connection to peer.");
builder.maxInboundMessageSize(104857600);
logger.info("maxInboundMessageSize is 104857600.");
if (tlsEnabled) {
builder.negotiationType(NegotiationType.TLS);
builder.sslContext(createSSLContext());
} else {
builder.usePlaintext(true);
}
return builder;
}
I have submitted a ticket on fabric Jira to support changing the variable without overriding.

Hyperledger Fabric chaincode instantiation returns timeout expired

I've been working around with Fabric for a a few months now, and I've been trying to run a somewhat complex virtual machine, the Ethereum Virtual Machine within a chaincode. It is written in JavaScript so I worked with the nodeJS chaincode version.
I packed the the VM with my chaincode in a directory that i install and instantiate onto the peer. The install completes and exits with no errors, however the instantiation after hanging for a few minutes returns me an error:
Error: Error endorsing chaincode: rpc error: code = Unknown desc = timeout expired while starting chaincode mychaincode:1.0(networkid:dev,peerid:peer0.org1.example.com,tx:....
It should run for quite a few minutes at least as the added packages are ~15MB, according to the example nodejs chaincode runs for a minute at least.
The example nodejs chaincode (chaincode_example02) runs perfectly on both BYFN network from the tutorial and on a basic-network that I've started. My environment was set up according to the documentation (v1.1.0) from the fabric-samples repository (v1.1.0). Even if I only add one package to the example chaincode with the require method, it hangs, than return error.
I've been searching for a flag or config where I can set the timeout value for chaincode instantiation, but with no luck. Where could I increase the timeout value?
Which log should I provide in order to step forward in searching for the soution?
Thanks is advance,
Balint
You can modify the chaincode.startuptimeout config by adding a CORE_CHAINCODE_STARTUPTIMEOUT environment variable to the base/peer-base.yaml docker compose file specifying something other than the default.

hyperledger-composer nodejs sdk ping fails

Using the hyperledger-composer NodeJS SDK at latest levels. Attempting to ping network using the provided example code in composer-admin ping
var fs = require('fs');
var path = require('path');
var composer = require('composer-admin');
var composerClient = require('composer-client');
var composerCommon = require('composer-common');
var adminConnection = new composer.AdminConnection();
adminConnection.connect(config.composer.connectionProfile, config.composer.adminID, config.composer.adminPW)
.then(function(){
adminConnection.ping()
.then(function(result){
console.log("network ping successful: ",result);
res.send({ping: result});
})
.catch(function(error){
var _error = error;
console.log("network ping failed: "+_error);
res.send({ping: _error.toString()});
});
});
When executing this command, get the following response:
Error: error trying to ping.
Error: error trying to query chaincode.
Error: Missing "chaincodeId" parameter in the proposal request
However, the ping command takes no parameters. Help, please?
Inspecting the composer-admin code, shows that the security context is evaluated prior to a ping. When I look at the security context object returned by the new composer.AdminConnection() request, the network identifier object is empty - undefined. If I update that field with my network identifier using the following code
adminConnection.securityContext.connection.businessNetworkIdentifier = "zerotoblockchain-network#0.1.6";
the error messages change to:
Error: error trying to ping.
Error: error trying to query chaincode.
Error: could not find chaincode with name 'zerotoblockchain-network#0.1.6' - make sure the chaincode zerotoblockchain-network#0.1.6 has been successfully instantiated and try again
Using the admin interface to list networks returns this network as deployed. Don't understand why the message is about chaincode when the update was to the network identifier as created by the composer archive and deployed via the composer deploy services.
Whether or not this was a bug, it's been resolved in the latest version of composer (v0.12). Highly recommend removing version numbers from package.json file for all composer node modules as these are updated VERY frequently and version mismatches are generating many spurious erros.

Resources