graphprotocol / graphprotocol/indexer

Agent starting in semi-working state after unhandled promise rejection

Open
#785 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug p1
Dominant language
TypeScript
Stars
262
Forks
148
PR merge metrics
No merged PRs in 30d

Description

Reports show that undetected errors in offchain subgraph ID parsing from environment variables cause the Agent to start in a partially operational mode.

This is the error log of an unhandled promise rejection involving a malformed deployment ID:

[2023-09-20 19:05:15.592 +0000] WARN (IndexerAgent/1 on d456316fe743): Unhandled promise rejection
    err: {
      "type": "IndexerError",
      "message": "Unhandled promise rejection",
      "stack":
          IndexerError: Unhandled promise rejection
              at indexerError (/opt/indexer/packages/indexer-common/dist/errors.js:173:12)
              at process.<anonymous> (/opt/indexer/packages/indexer-agent/dist/commands/start.js:351:56)
              at process.emit (node:events:527:28)
              at process.emit (node:domain:475:12)
              at emit (node:internal/process/promises:140:20)
              at processPromiseRejections (node:internal/process/promises:274:27)
              at processTicksAndRejections (node:internal/process/task_queues:97:32)
      "code": "IE035",
      "explanation": "https://github.com/graphprotocol/indexer/blob/main/docs/errors.md#ie035",
      "cause": {
        "type": "Error",
        "message": "Invalid subgraph deployment ID: QmQjmWt1vLf9aZmbpE8Amoyt5zJoawAJpEqwWJLAwXfkr8QmWfvBwdLL6e65Zddr6zbkcUY1mkyCKxyMLH33zTyfbJLn",
        "stack":
            Error: Invalid subgraph deployment ID: QmQjmWt1vLf9aZmbpE8Amoyt5zJoawAJpEqwWJLAwXfkr8QmWfvBwdLL6e65Zddr6zbkcUY1mkyCKxyMLH33zTyfbJLn
                at new SubgraphDeploymentID (/opt/indexer/node_modules/@graphprotocol/common-ts/dist/subgraphs/index.js:37:19)
                at /opt/indexer/packages/indexer-agent/dist/commands/start.js:500:149
                at Array.map (<anonymous>)
                at /opt/indexer/packages/indexer-agent/dist/commands/start.js:500:138
                at Generator.next (<anonymous>)
                at fulfilled (/opt/indexer/packages/indexer-agent/dist/commands/start.js:5:58)
                at processTicksAndRejections (node:internal/process/task_queues:96:5)
      }
    }

After that, only the monitorEthBalance, monitorNetworkPauses and monitorIsOperator routines were actively running.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the startup path in packages/indexer-agent/dist/commands/start.js, especially the locations shown in the stack trace, and inspect how environment-provided subgraph deployment IDs are handled. Reproduce the malformed-ID case and trace the resulting promise rejection. Done should mean invalid configuration is handled explicitly rather than leaving the Agent partially operational.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
backend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.