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

Add retry logic to app check #5676

Merged
merged 17 commits into from
Nov 16, 2021
Merged

Add retry logic to app check #5676

merged 17 commits into from
Nov 16, 2021

Conversation

hsubox76
Copy link
Contributor

  • Block exchange requests for certain periods of time on certain error codes
    • 400, 404: 1 day
    • Other error codes: exponential backoff
  • Fix bugs causing duplicate calls to listeners
  • Do not make multiple requests to exchange endpoint if a request is already in flight
  • Start a token listener when App Check is initialized to avoid extra wait time on first getToken() call

@changeset-bot
Copy link

changeset-bot bot commented Oct 28, 2021

🦋 Changeset detected

Latest commit: 5e0d22b

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 3 packages
Name Type
@firebase/app-check Patch
@firebase/app-check-compat Patch
firebase Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@google-cla google-cla bot added the cla: yes label Oct 28, 2021
@google-oss-bot
Copy link
Contributor

google-oss-bot commented Oct 28, 2021

Binary Size Report

Affected SDKs

  • @firebase/app-check

    Type Base (e0fe2b6) Head (1ddcc79) Diff
    browser 22.3 kB 25.1 kB +2.80 kB (+12.5%)
    esm5 26.6 kB 29.7 kB +3.05 kB (+11.4%)
    main 27.8 kB 30.9 kB +3.03 kB (+10.9%)
    module 22.3 kB 25.1 kB +2.80 kB (+12.5%)
  • @firebase/firestore

    Type Base (e0fe2b6) Head (1ddcc79) Diff
    browser 225 kB 225 kB +4 B (+0.0%)
    esm5 282 kB 282 kB +4 B (+0.0%)
    main 423 kB 423 kB +4 B (+0.0%)
    module 225 kB 225 kB +4 B (+0.0%)
    react-native 226 kB 226 kB +4 B (+0.0%)
  • @firebase/storage

    Type Base (e0fe2b6) Head (1ddcc79) Diff
    browser 52.4 kB 54.5 kB +2.08 kB (+4.0%)
    esm5 57.8 kB 60.5 kB +2.73 kB (+4.7%)
    main 54.0 kB 57.3 kB +3.32 kB (+6.2%)
    module 52.4 kB 54.5 kB +2.08 kB (+4.0%)
  • firebase

    Type Base (e0fe2b6) Head (1ddcc79) Diff
    firebase-app-check-compat.js 20.8 kB 22.7 kB +1.90 kB (+9.1%)
    firebase-app-check.js 80.4 kB 89.8 kB +9.41 kB (+11.7%)
    firebase-compat.js 749 kB 751 kB +1.97 kB (+0.3%)
    firebase-firestore-compat.js 278 kB 278 kB +4 B (+0.0%)
    firebase-firestore.js 763 kB 763 kB +11 B (+0.0%)
    firebase-storage-compat.js 38.1 kB 38.2 kB +156 B (+0.4%)
    firebase-storage.js 140 kB 145 kB +5.58 kB (+4.0%)

Test Logs

@google-oss-bot
Copy link
Contributor

google-oss-bot commented Oct 28, 2021

Size Analysis Report

Affected Products

Diffs between base commit (e0fe2b6) and head commit (1ddcc79) are too large (67,947 characters) to display.

Please check below links to see details from the original test log.

@hsubox76 hsubox76 changed the title WIP: Add retry logic to app check Add retry logic to app check Nov 8, 2021
packages/app-check/src/internal-api.test.ts Show resolved Hide resolved
packages/app-check/src/internal-api.test.ts Show resolved Hide resolved
packages/app-check/src/api.ts Outdated Show resolved Hide resolved
packages/app-check/src/providers.test.ts Show resolved Hide resolved
Comment on lines 68 to 75
if (!this._app || !this._platformLoggerProvider) {
// This should only occur if user has not called initializeAppCheck().
// We don't have an appName to provide if so.
// This should already be caught in the top level `getToken()` function.
throw ERROR_FACTORY.create(AppCheckError.USE_BEFORE_ACTIVATION, {
appName: ''
});
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we discussed it in another PR that we don't need this check and can assume the 2 properties are available.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, looks like it was merged with the recaptcha enterprise PR, I'll rebase. I also need to add all this functionality for recaptcha enterprise.

packages/app-check/src/providers.ts Show resolved Hide resolved
@hsubox76
Copy link
Contributor Author

Also rebased and added recaptcha enterprise changes.

@hsubox76 hsubox76 assigned Feiyang1 and unassigned hsubox76 Nov 10, 2021
Copy link
Member

@Feiyang1 Feiyang1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If possible, please don't rebase PRs under review, use merge instead. Rebasing removes the ability for reviewers to only review the changes since their last review. and They have to review the entire PR to find the differences, which is painful.

packages/app-check/src/internal-api.test.ts Outdated Show resolved Hide resolved
@Feiyang1 Feiyang1 assigned hsubox76 and unassigned Feiyang1 Nov 12, 2021
@hsubox76 hsubox76 merged commit 6f0049e into master Nov 16, 2021
@hsubox76 hsubox76 deleted the ch-appcheck-retry branch November 16, 2021 23:00
@google-oss-bot google-oss-bot mentioned this pull request Nov 17, 2021
@firebase firebase locked and limited conversation to collaborators Dec 17, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants