ipfs / ipfs/helia

Delegated HTTP routers not used for pubsub publish/subscribe

Open
#926 0 comments 0 reactions 0 assignees View on GitHub
need/analysis P2
Dominant language
TypeScript
Stars
1.3k
Forks
159
Avg merge
2h 11m
Merged PRs (30d)
16

Description

When Helia is configured to use delegated routing HTTP routers, pubsub publish/subscribe does not trigger any delegated router provider lookups. Publish fails with `PublishError.NoPeersSubscribedToTopic`, and subscribe silently succeeds but never connects to providers that are actually subscribed.

The delegated router in this repro only implements `/routing/v1/providers/*`, and is pre-seeded with a provider record for the pubsub topic routing CID. Despite that, Helia never calls `getProviders`, and no peers are dialed.

## Reproduction

```bash
git clone https://github.com/Rinse12/delegated-routing-pubsub-provider-repro
npm install
npm run start
```

### Observed output

```
[router] listening on http://127.0.0.1:25150/
[provider] peerId 12D3KooWRnAH1aYz4e89x2ZVKB61Hug5VTiM98D3P8ymaUukwL7L
[provider] addrs
[provider] pubsub topic /plebbit/pubsub-repro/1
[provider] routing cid bafkreia36n7k4rrs2wndyn4enw7ttsfajplrrdczaktuvvrebtpmcf6rwa

[resolver] attempting publish without manual discovery
[resolver] subscribers before publish: 0
[resolver] publish error: Error PublishError.NoPeersSubscribedToTopic

[resolver] attempting subscribe without manual discovery
[resolver] subscribers before subscribe: 0
[resolver] subscribers after subscribe: 0
[resolver] connections after pubsub attempt: 0
[router] provider queries handled: 0
```

The router logs no `/routing/v1/providers/*` requests, and the resolver never
connects to the provider.

## Expected behavior

- Helia should query delegated routing for providers of the pubsub routing CID
(`floodsub:${topic}`) before publishing/subscribing.
- The delegated router should receive `/routing/v1/providers/*` requests.
- The resolver should dial the provider from the delegated routing response.
- Publish should succeed and/or subscribe should connect to at least one peer who's subscribed to the topic.

## Actual behavior

- No delegated routing provider lookups occur (provider query count stays 0).
- Publish fails with `PublishError.NoPeersSubscribedToTopic`.
- Subscribe returns without error but no peer connections are made.

## Environment

- Node.js: 20.18.0
- `helia`: 6.0.14
- `@libp2p/gossipsub`: 15.0.11
- `@helia/delegated-routing-v1-http-api-client`: 5.1.4

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.