graph-node
graph-node copied to clipboard
Add transaction hash to SubgraphError and error message when available
Do you want to request a feature or report a bug?
feature request
What is the current behavior?
For a runtime null-pointer error, it looks like the below:
Mapping aborted at src/common/creators.ts, line 162, column 19, with message: unexpected null wasm backtrace: 0: 0x80cd - <unknown>!src/common/creators/createWithdraw 1: 0x833e - <unknown>!src/mappings/pool/handleBurn in handler `handleBurn` at block #11014326 (69e39fcb23c85c462f832a35e84f506424a97538721993451872cada7cbc6089)
While it shows the block number and the block hash, it has no info about the relevant transaction, which is super helpful for debugging the issue.
If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem.
What is the expected behavior?
Transaction hash should be included in the error message
Mapping aborted at src/common/creators.ts, line 162, column 19, with message: unexpected null wasm backtrace: 0: 0x80cd - <unknown>!src/common/creators/createWithdraw 1: 0x833e - <unknown>!src/mappings/pool/handleBurn in handler `handleBurn` at block #11014326 (69e39fcb23c85c462f832a35e84f506424a97538721993451872cada7cbc6089) at transaction xxxxxx
Also, SubgraphError entity in the health endpoint https://api.thegraph.com/index-node/graphql should include transaction.
type SubgraphError {
message: String!
transaction: Transaction
block: Block
handler: String
deterministic: Boolean!
}
type Transaction {
hash: String!
// ...
}
thanks @0xbe1! @tilacog I know you added transaction hash to the logs in quite a few places, but was it missed on error logging?
The error log would show this context, but the error that goes into the DB and then the indexing status API doesn't. A way to resolve this is to add a context field to the SubgraphError struct and to the subgraph_error DB table, and somehow fill it when instantiating an error. The context could be a json blob, to keep it chain agnostic.
Looks like this issue has been open for 6 months with no activity. Is it still relevant? If not, please remember to close it.
Still relevant.