Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[App Check] Install catch handler for promise in Deferred. #7822

Merged
merged 2 commits into from
Nov 29, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/shiny-houses-stare.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@firebase/app-check': patch
---

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.
6 changes: 6 additions & 0 deletions packages/app-check/src/proactive-refresh.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,9 @@ export class Refresher {
this.stop();
try {
this.pending = new Deferred();
this.pending.promise.catch(_e => {
/* ignore */
});
await sleep(this.getNextRun(hasSucceeded));

// Why do we resolve a promise, then immediate wait for it?
Expand All @@ -74,6 +77,9 @@ export class Refresher {
this.pending.resolve();
await this.pending.promise;
this.pending = new Deferred();
this.pending.promise.catch(_e => {
/* ignore */
});
await this.operation();

this.pending.resolve();
Expand Down
Loading