Skip to content

Fix indexer 502: restore 5s delay before indexer call in usePublish #252

@realproject7

Description

@realproject7

Problem

After createStoryline or chainPlot tx confirms, the indexer API call returns 502 ("Failed to fetch transaction receipt"). The server-side RPC node hasn't synced the receipt yet due to Base Sepolia load-balanced RPC propagation delay.

Evidence: TX 0x55218d... succeeded on-chain but indexer returned 502. Manual replay 1 minute later succeeded.

Root cause: Commit 71c66b8 ([#170]) removed the 5s client-side delay from usePublish.ts with the reasoning that "server-side retry window (30s) is sufficient." It's not — especially for heavy txs like createStoryline (~14.4M gas). The old contract worked because the 5s delay was still in place at that time.

Fix

In src/hooks/usePublish.ts, restore the 5s delay before the indexer fetch:

// Before (line 90-92)
// 4. Trigger indexer
setState("indexing");
await fetch(opts.indexerRoute, {

// After
// 4. Trigger indexer (delay for RPC propagation on Base Sepolia)
setState("indexing");
await new Promise((r) => setTimeout(r, 5000));
await fetch(opts.indexerRoute, {

Files

  • src/hooks/usePublish.ts — add await new Promise((r) => setTimeout(r, 5000)); before the indexer fetch (after setState("indexing"))

Acceptance criteria

  • 5s delay before indexer API call in usePublish
  • Storyline creation successfully indexes after tx confirmation
  • npm run typecheck passes

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions