From 28370b10430ccda7b2e48a53d24fa84c19a69603 Mon Sep 17 00:00:00 2001 From: Julian Lam Date: Mon, 26 Feb 2024 11:34:03 -0500 Subject: [PATCH] fix: put postcount retrieval behind try..catch so errors are handled appropriately --- src/activitypub/actors.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/activitypub/actors.js b/src/activitypub/actors.js index 8fdbc543a5..7143d7cfe3 100644 --- a/src/activitypub/actors.js +++ b/src/activitypub/actors.js @@ -51,8 +51,13 @@ Actors.assert = async (ids, options = {}) => { } // Post count - const outbox = actor.outbox ? await activitypub.get('uid', 0, actor.outbox) : { totalItems: 0 }; - actor.postcount = outbox.totalItems; + try { + const outbox = actor.outbox ? await activitypub.get('uid', 0, actor.outbox) : { totalItems: 0 }; + actor.postcount = outbox.totalItems; + } catch (e) { + // no action required + winston.verbose(`[activitypub/actor.assert] Unable to retrieve post counts for ${actor.id}`); + } // Followers url for backreference if (actor.hasOwnProperty('followers') && activitypub.helpers.isUri(actor.followers)) {