Skip to content

Node.js based forum software built for the modern web

fix: put postcount retrieval behind try..catch so errors are handled appropriately

Julian Lam28370b10430c
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)) {