%3C%21-- Global site tag (gtag.js) - Google Analytics --%3E

Troubleshooting errors

There are plenty of ways to troubleshoot an error in your solution as well as multiple points where information about what's happening may be useful to diagnose your situation.

Your tools

Your main tools are the following:

  • Code editor/IDE: we recommend Visual Studio code, as it makes it easier to spot code errors and connect dependencies between files.
  • Terminal: your preferred terminal will help you navigate and work with the various components in your workflow.
  • Docker: Docker runs the containers with that give life to your local blockchain network. It runs multiple containers, each one of them has logs and setting you can access from your Terminal.
  • Your project folder: this is where your code resides and is accessible to you.
  • Hurley folder: it's usually located at ~/hyperledger-fabric-network/ it contains all the files you need to have a local blockchain network running.
  • Local dependencies: you need some previous components in your computer to run Hyperledger Fabric and therefore Convector. Take a look here for them as most of the errors usually come from missing pre-requisites.

Components

Overall these are the main components in your development environment:

  • Your chaincode code.
  • Your running environment.
    • That includes the containers running in Docker for the blockchain network, but also the files it depends on in your local file system and the containers running the chaincode you developed.
  • Your server (if you have one).

Logs

Using logs is the most effective way to see what happens. We typically recommend that you develop with debugging on like explained here. That way you can see what happens inside of your server and your chaincode.

Logs sources are the following:

  1. Your Terminal console when running your chaincode with debugging on.
  2. Your Terminal console when running the server.
  3. Docker logs through your Terminal console for the blockchain network
  4. Docker logs through your Terminal console for a running chaincode logs.

By default, you will get logs from source 1 and 2. But sometimes you may need more logs or to dig into the existing ones.

What you need to is the following in your preferred Terminal Console:

  1. Find your containers running.
    1. docker ps
    2. This will bring a list of containers in your environment: 
  2. Pick the Container ID or Name to get its logs. 
    1. docker logs <container-id> for example docker logs
    2. Optionally you can get the logs in a stream (realtime) but that Terminal tab will be locked with these logs:  docker logs -f 365a949ae334

You can use that same method to get chaincode logs, after installing your chaincode, repeat step 1.a, spot the container running the chaincode and run 2.a again.

A chaincode container looks like this:

Debugging

Did this answer your question? Thanks for the feedback There was a problem submitting your feedback. Please try again later.

Still need help? Contact Us Contact Us