hyperledger / hyperledger/fabric-samples
Error while fetching asset modification history through REST
- Dominant language
- Go
- Stars
- 3k
- Forks
- 3.5k
- Avg merge
- 3d 20h
- Merged PRs (30d)
- 6
Description
Hello team,
I am using hyperledger fabric 2.4.9 test-network to build an application, the chaincode is written in Go using contract api.
I have exposed the chaincode functions as REST API using `express js` and I have used the scripts `AppUtil.js` and `CAUtil.js`
available under `test-application/javascript` directory in `fabric-samples`.
When I invoke the chaincode methods using the peer command in my CLI all my methods work fine as expected.
When I start the express server for` peerOrganization - org1`(known as orgA in my case) and test the methods from Postman client
from the desktop everything works fine.
However, When I start the express server for` peerOrganization - org2`(knows as orgB in my case) and test the methods from Postman client from the desktop, the REST API for invoking the` getHistoryForTransaction`(which takes in transaction ID as a parameter in the url) throws an error which implies that there is no data in `HistoryDB` in the network, despite the asset being created and present in the ledger, all other API's for querying the asset work as expected. The issue is faced only when invoking the `getHistoryForTransaction` which calls `GetHistoryForKey()` for getting the asset modification history.
Once, I am not able to fetch the history, the API stops working for orgA also and even from the `peer CLI` I get an error.
I am attaching the screenshot of my getTransactionHistory function and the rest api as well as the error.
I have tried checking the peer logs and debugging the functions but I am not able to resolve this issue. Please help




Summary: The historyDB is getting timed out as it works as expected initially and then it fails sending a response even though asset exisits in the ledger
Contributor guide
Assessment
This issue has not been assessed yet.