Skip to content

Commit 1d32137

Browse files
authored
[App Check] Install catch handler for promise in Deferred. (#7822)
Install catch handlers for promises in the Derferred object used by in AppCheck. There were some cases where the promise was cancelled and this bubbled up error messages to our clients' applications despite this being expected behavior. This change is to alleviate the logging reported in issue #7805.
1 parent e8ff8b8 commit 1d32137

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

.changeset/shiny-houses-stare.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@firebase/app-check': patch
3+
---
4+
5+
Prevent App Check from logging "uncaught" cancelled promises. The cancelled promises are part of App Check's expected behavior, and their cancellation wasn't intended to produce errors or warnings. See issue #7805.

packages/app-check/src/proactive-refresh.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,9 @@ export class Refresher {
6464
this.stop();
6565
try {
6666
this.pending = new Deferred();
67+
this.pending.promise.catch(_e => {
68+
/* ignore */
69+
});
6770
await sleep(this.getNextRun(hasSucceeded));
6871

6972
// Why do we resolve a promise, then immediate wait for it?
@@ -74,6 +77,9 @@ export class Refresher {
7477
this.pending.resolve();
7578
await this.pending.promise;
7679
this.pending = new Deferred();
80+
this.pending.promise.catch(_e => {
81+
/* ignore */
82+
});
7783
await this.operation();
7884

7985
this.pending.resolve();

0 commit comments

Comments
 (0)