Skip to content

Commit 75acee6

Browse files
authored
fix: do not fail update if firebase user does not exist (#1343)
1 parent 9c48ffd commit 75acee6

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

shared/src/database/services/contributor/contributor.service.ts

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -81,16 +81,22 @@ export class ContributorService extends BaseService {
8181
});
8282

8383
if (!existing) {
84-
return this.resultFail('Recipient not found');
84+
return this.resultFail('Contributor not found');
8585
}
8686

8787
if (!contributor.contact?.update?.data?.email) {
8888
return this.resultFail('Contributor email is required');
8989
}
9090

91-
await this.firebaseAuthService.updateByUid(existing.account.firebaseAuthUserId, {
92-
email: contributor.contact?.update?.data?.email?.toString() ?? undefined,
93-
});
91+
try {
92+
await this.firebaseAuthService.updateByUid(existing.account.firebaseAuthUserId, {
93+
email: contributor.contact?.update?.data?.email?.toString() ?? undefined,
94+
});
95+
} catch (error) {
96+
// for now, dont fail the update if firebase user cannot be updated, because there is no auth user for every contributor
97+
console.warn('Could not update Firebase Auth user for contributor:', error);
98+
}
99+
94100
const updatedContributor = await this.db.contributor.update({
95101
where: { id: contributor.id?.toString() },
96102
data: contributor,

0 commit comments

Comments
 (0)