From 9b13ec9c0c6edd6a091605f0c85d2291933b754c Mon Sep 17 00:00:00 2001 From: Laura Hausmann Date: Tue, 24 Oct 2023 20:44:30 +0200 Subject: [PATCH] [backend] Catch errors in refetchPublicKeyForApId --- .../backend/src/remote/activitypub/db-resolver.ts | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/packages/backend/src/remote/activitypub/db-resolver.ts b/packages/backend/src/remote/activitypub/db-resolver.ts index d8aa3b706..961d67ceb 100644 --- a/packages/backend/src/remote/activitypub/db-resolver.ts +++ b/packages/backend/src/remote/activitypub/db-resolver.ts @@ -206,12 +206,17 @@ export default class DbResolver { } public async refetchPublicKeyForApId(user: CacheableRemoteUser): Promise { - await updatePerson(user.uri!, undefined, undefined, user); - let key = await UserPublickeys.findOneBy({ userId: user.id }); - if (key != null) { - await publicKeyByUserIdCache.set(user.id, key); + try { + await updatePerson(user.uri!, undefined, undefined, user); + let key = await UserPublickeys.findOneBy({ userId: user.id }); + if (key != null) { + await publicKeyByUserIdCache.set(user.id, key); + } + return key; + } + catch { + return null; } - return key; } }