Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unable to registerUser for Hyperledger Fabric - fabcar sample project

I try to run sample application as stated here : http://hyperledger-fabric.readthedocs.io/en/release/write_first_app.html

Everything looks good until I ran this command : node registerUser

Error :

Store path:/Users/johndoe/Desktop/myProject/fabric-samples/fabcar/hfc-key-store Successfully loaded admin from persistence Failed to register: Error: fabric-ca request register failed with errors [[{"code":0,"message":"No identity type provided. Please provide identity type"}]]

I checked logs by running docker logs ca.example.com command:

2017/11/08 09:43:07 [DEBUG] Successful authentication of 'admin'

2017/11/08 09:43:07 [DEBUG] Register request received

2017/11/08 09:43:07 [DEBUG] Received registration request from admin: &{RegistrationRequest:{Name:user1 Type: Secret:<> MaxEnrollments:1 Affiliation:org1.department1 Attributes:[] CAName:}}

2017/11/08 09:43:07 [DEBUG] Registration of 'user1' failed: No identity type provided. Please provide identity type

2017/11/08 09:43:07 [INFO] 172.18.0.1:60190 - "POST /api/v1/register" 0

Did I miss anything here? I successfully ran node enrollAdmin.js and able to get the generated eCert & key material in hfc-key-store

like image 310
shkhssn Avatar asked Nov 08 '17 09:11

shkhssn


People also ask

What is fabcar in Hyperledger fabric?

Fabcar was designed to leverage a network stripped down to only the components necessary to run an application. And even with that level of simplification, the ./startFabric.sh script takes care of the installation and configuration not baked into the network itself.

How do you put a fabric sample in?

The command that follows will perform the following steps: If needed, clone the hyperledger/fabric-samples repository. Checkout the appropriate version tag. Install the Hyperledger Fabric platform-specific binaries and config files for the version specified into the /bin and /config directories of fabric-samples.


2 Answers

In my case, adding the user's role type make it works.

return fabric_ca_client.register({enrollmentID: 'user1', affiliation: 'org1.department1',role: 'client'}, admin_user);
like image 112
S.Skmt Avatar answered Oct 17 '22 20:10

S.Skmt


I was having same trouble but after adding role: 'client' to the registeUser file it ran and registered successfully.

before- adding the role: 'client'

Anoops-MacBook:fabcar anoopdixit$ node registerUser.js
Store path:/Users/anoopdixit/Documents/Blockchain/projects/Hyperledger-Fabric/fabric-samples/fabcar/hfc-key-store
Successfully loaded admin from persistence
Failed to register: **Error:** fabric-ca request register failed with errors [[{"code":0,"message":"No identity type provided. Please provide identity type"}]]
Anoops-MacBook:fabcar anoopdixit$

after:adding the *role: 'client'

Anoops-MacBook:fabcar anoopdixit$ node registerUser.js
 Store path:/Users/anoopdixit/Documents/Blockchain/projects/Hyperledger-Fabric/fabric-samples/fabcar/hfc-key-store
Successfully loaded admin from persistence
Successfully registered user1 - secret:aMgShhReEivm
Successfully enrolled member user "user1" 
**User1 was successfully registered** and enrolled and is ready to intreact with the fabric network
Anoops-MacBook:fabcar anoopdixit$
like image 40
AnoopDixit Avatar answered Oct 17 '22 22:10

AnoopDixit