Skip to content

Commit df599e1

Browse files
committed
handle advertisement with no entries
Signed-off-by: Miroslav Bajtoš <oss@bajtos.net>
1 parent ef48905 commit df599e1

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

indexer/lib/advertisement-walker.js

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,15 @@ export async function fetchAdvertisedPayload (providerAddress, advertisementCid)
8383
const previousAdvertisementCid = advertisement.PreviousID?.['/']
8484
debug('advertisement %s %j', advertisementCid, advertisement)
8585

86-
const entriesCid = advertisement.Entries['/']
86+
const entriesCid = advertisement.Entries?.['/']
87+
if (!entriesCid || entriesCid === 'bafkreehdwdcefgh4dqkjv67uzcmw7oje') {
88+
// An empty advertisement with no entries
89+
// See https://github.com/ipni/ipni-cli/blob/512ef8294eb717027b72e572897fbd8a1ed74564/pkg/adpub/client_store.go#L46-L48
90+
// https://github.com/ipni/go-libipni/blob/489479457101ffe3cbe80682570b63c12ba2546d/ingest/schema/schema.go#L65-L71
91+
debug('advertisement %s has no entries: %j', advertisementCid, advertisement.Entries)
92+
return { previousAdvertisementCid }
93+
}
94+
8795
const entriesChunk =
8896
/** @type {{
8997
Entries: { '/' : { bytes: string } }[]

0 commit comments

Comments
 (0)