Error: Configuration must be a connection profile object or Client object

417 views Asked by At

I am trying to connect to a peer of the network via fabric-network SDK 2.2.

I have taken as starting point the connection profile provided in here, modified to my network setup and try to connect, but got the error in the title.

As test, I have copied the example, expecting to receive a different error related to configuration, but the error is the same (so should not be a problem with the format of the JSON).

Console log shows the JSON is properly read from the file.

Any way I can debug fabric-network SDK to find out where the problem is ?

Thanks in advance for your help!

2

There are 2 answers

1
david_k On

Did you parse the JSON string into an actual object ? I suspect you are trying to just pass a string into the connect request. Take a look here https://github.com/hyperledger/fabric-samples/blob/22393b629bcac7f7807cc6998aa44e06ecc77426/fabcar/javascript/invoke.js#L17 to see an example of how a connection profile is read and parsed into a json object before being used in the Gateway.connect method.

0
Badr Bellaj On

This generaly happen when you call

await gateway.connect(ccp, { wallet, identity: USER_NAME, discovery: { enabled: true, asLocalhost: true } });

Without a valid wallet or ccp, So check if both are correctly initialized