IBM-Blockchain-Archive / car-lease-demo

A demonstration using IBM Blockchain to show how the lifecycle of vehicles can be recorded on a blockchain
Other
170 stars 304 forks source link

Clicking on View App button after successfully deploying Car Lease demo app to Bluemix results in "Identity or token does not match" error #102

Open sanjay-saxena opened 7 years ago

sanjay-saxena commented 7 years ago

Used this tutorial to deploy Car Lease demo app to Bluemix while working on the first part of the three-part Blockchain developer course. The deployment went clean and the app was operational. I let the app and the service run overnight so that I could continue with the second part of the three-part course the next day.

However, when I tried to interact with the app the next day, I received an error message in the red banner at the top of the page saying that I should delete both the app and the service and try again. So, I deleted both the app and the service using the Bluemix dashboard and deleted the project from hub.jazz.net. Then, I followed the process to deploy the Car Lease demo once again. The deployment goes clean again and I see a green circle indicating that the app is running. But, when I tried to view the app, I see the familiar red banner with the error message saying that I should delete both the app and the service and try again. Also, the error message includes Identity or token does not match.

Digging a bit deeper into the logs, I see errors and a potential stack trace as shown below:

APP/0 designed for a production environment, as it will leakMar 10, 2017 11:30:31 AM
APP/0 [!] VCAP_SERVICES detectedMar 10, 2017 11:30:32 AM
APP/0 peer0: grpcs://0142b35d5dc94f76a00c7957f78493cc-vp0.us.blockchain.ibm.com:30004Mar 10, 2017 11:30:32 AM
APP/0 peer2: grpcs://0142b35d5dc94f76a00c7957f78493cc-vp1.us.blockchain.ibm.com:30004Mar 10, 2017 11:30:32 AM
APP/0 peer3: grpcs://0142b35d5dc94f76a00c7957f78493cc-vp3.us.blockchain.ibm.com:30004Mar 10, 2017 11:30:32 AM
APP/0 Server UpMar 10, 2017 11:30:32 AM
APP/0 ERROR Startup OUTPUT: "Failed to enroll registrar with WebAppAdmin abde14b29c"Mar 10, 2017 11:30:33 AM
APP/0 at /home/vcap/app/node_modules/grpc/src/node/src/client.js:417:17 code: 2, metadata: Metadata { _internal_repr: {} } }Mar 10, 2017 11:30:33 AM
APP/0 at Function.process_params (/home/vcap/app/node_modules/express/lib/router/index.js:335:12)Mar 10, 2017 11:37:01 AM
APP/0 at trim_prefix (/home/vcap/app/node_modules/express/lib/router/index.js:317:13)Mar 10, 2017 11:37:01 AM
APP/0 at Layer.handle [as handle_request] (/home/vcap/app/node_modules/express/lib/router/layer.js:95:5)Mar 10, 2017 11:37:01 AM
APP/0 at /home/vcap/app/app.js:279:5Mar 10, 2017 11:37:01 AM
APP/0 at /home/vcap/app/node_modules/express/lib/router/index.js:284:7Mar 10, 2017 11:37:01 AM
APP/0 at /home/vcap/app/app.js:286:15
APP/0 { Error: Identity or token does not match.Mar 10, 2017 11:30:33 AM
APP/0 ERROR Startup OUTPUT: {"code":2,"metadata":{"_internal_repr":{}}}

Steps to Reproduce

  1. Deploy Car Lease demo app to Bluemix. Let it run overnight.
  2. Try to interact with it next day.
  3. Delete the app and the service. And, the project from hub.jazz.net.
  4. Try redeploy Car Lease demo app to Bluemix and click on the View App button.

Environment

liam-grace commented 7 years ago

The error Error: Identity or token does not match appears when the car lease demo restarts in bluemix, do you see anything in the logs to suggest this happened?

sanjay-saxena commented 7 years ago

Please look at the description. I have provided a stack trace from the logs as well as other errors.

liam-grace commented 7 years ago

@sanjay-saxena Thanks for the app logs, but in this case the peer and chaincode logs would be more useful in diagnosing the issue

raghuskhasyap commented 7 years ago

Encountering the same issue as @Sanjay-Saxena while the deployment goes successful on BlueMix env but when clicking on the link, encounters the error "There was an error starting the demo. Please try again. Ensure you delete both the demo and the blockchain service. Identity or token does not match"

Awaiting some support in getting this issue resolved. - Thanks in Advance.

liam-grace commented 7 years ago

@sanjay-saxena When a user enrolls with a peer in Hyperledger Fabric v0.6, they are given a certificate that is saved in the peer and in the application file system. In the car lease demo, the certificates are stored in a folder called keyValStore that is in the root of the project. In bluemix, when a nodejs application is restarted, changes to the file system are deleted, so the certificates are lost. However, the peer hasn't lost it's copy of the certificates, so when the app restarts and enrolling occurs, since the app cant provide certificates, the Identity or token does not match error is given.

The only solution to this is to ensure that the app and blockchain service has been completely removed, and any other blockchain services that exist with the name car_lease_blockchain, across regions, are removed.

murtazanasir commented 7 years ago

@14gracel Thanks for the explanation. Is there any way to get around this problem? I've been trying to make some changes in the demo code, but when I push it to bluemix, I get the Identity or token does not match error.