Skip to content

[Bug] Indexer race condition — 502 on receipt fetch after tx confirms #154

@realproject7

Description

@realproject7

Description

/api/index/donation (and likely other indexer routes) returns 502 when called immediately after waitForTransactionReceipt completes. The RPC node doesn't have the receipt available on the next call (likely load-balanced to a different node).

Steps to reproduce

  1. Donate to a story
  2. Tx confirms on-chain
  3. Indexer is called immediately → 502 ("Failed to fetch transaction receipt")
  4. Manual retry later succeeds

Terminal logs

POST /api/index/donation 502 in 643ms
POST /api/index/donation 400 in 201ms

Affected routes

  • src/app/api/index/donation/route.ts (line 32-34)
  • Check src/app/api/index/storyline/route.ts and src/app/api/index/plot/route.ts for same pattern

Fix

Add a retry with short delay (e.g., 2-3 attempts with 1s backoff) when getTransactionReceipt fails, before returning 502.

🤖 Generated with Claude Code

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions