hirosystems / chainhook

Extract transactions from Stacks and Bitcoin and build event driven re-org resistant indexers and databases.
GNU General Public License v3.0
158 stars 65 forks source link

Include error-message as part of the GET/LIST endpoints to help with troubleshooting #396

Closed sabbyanandan closed 1 year ago

sabbyanandan commented 1 year ago

As a user, when the actively observing chainhooks fail to trigger either because of the errors in Chainhook itself or due to the issues when triggering the HTTP endpoint for a given event, I would like to know what and why it failed, so I can troubleshoot and course-correct.

The interruptions could be: a: Errors in Chainhook b: Having an incorrect HTTP endpoint as a trigger c: Having an unresponsive or erroring HTTP endpoint as a trigger d: Any runtime errors between the Chainhook node, Chainhook API, or HTTP endpoints

If we can include the error-message and can define a category for those errors, the Hiro Platform can handle them and gracefully let users know of the problem.

MicaiahReid commented 1 year ago

@lgalabru I'm wondering if we can store any errors that occur in checking or triggering a predicate and return them with PredicateStatus

MicaiahReid commented 1 year ago

Upon further investigation, we already store and return errors when evaluating a predicate: https://github.com/hirosystems/chainhook/blob/d688bcb67e37949f33b1dc8fb6cdd40e7cbafd4a/components/chainhook-cli/src/service/runloops.rs#L67

@BLuEScioN / @sabbyanandan - whenever the predicate status is "Interrupted", it will include an error. Do you think that will be sufficient for the platform to display more info to the user?

sabbyanandan commented 1 year ago

Woah! Awesome, I think this should suffice. Now, if we are able to trigger those errors, we can see how much of the information is floating through the pipes, and how we may want to massage them for the end-users. As far as the "caused by" or equivalent is clearer, that is all it matters to the end users.

smcclellan commented 1 year ago

@sabbyanandan If I'm following here, this issue is a no-op since we already surface the errors? Can it be closed?

sabbyanandan commented 1 year ago

@smcclellan: Before you close it, perhaps you can verify the functionality and share the sample JSON responses with the error messages. That way @BLuEScioN can review the JSON and explore how to further handle it gracefully for the end-users with the help of @andromeda995.

cc: @andresgalante

MicaiahReid commented 1 year ago

I've added some additional errors in #397

MicaiahReid commented 1 year ago

Here are the possible errors:

sabbyanandan commented 1 year ago

@MicaiahReid: Thanks.

@LakshmiLavanyaKasturi: Something to summarize in the Chainhook docs, perhaps under the error handling guide or similar.

github-actions[bot] commented 1 year ago

:tada: This issue has been resolved in version 1.1.0 :tada:

The release is available on GitHub release

Your semantic-release bot :package::rocket: