fix(app-check): Prevent redundant exchangeToken calls in debug mode#9187
fix(app-check): Prevent redundant exchangeToken calls in debug mode#9187hsubox76 merged 5 commits intofirebase:mainfrom
Conversation
|
hsubox76
left a comment
There was a problem hiding this comment.
Great PR, thanks! There's one nit (typo) and you need to run yarn format and I think it should be good.
| const appCheck = initializeAppCheck(app, { | ||
| provider: new ReCaptchaV3Provider(FAKE_SITE_KEY) | ||
| }); | ||
| const appCheckServie = appCheck as AppCheckService; |
There was a problem hiding this comment.
nit: typo -appCheckServie
There was a problem hiding this comment.
Thanks @hsubox76 , I've updated the branch.
|
Thanks again, this should go out in the next release, which is planned for Aug 7. |
Thanks @hsubox76 🚀 |
|
@hsubox76 It looks like the change isn't included in the v12.1.0 release - https://github.com/firebase/firebase-js-sdk/releases/tag/firebase%4012.1.0 |
This PR addresses a race condition in
getToken()where multiple concurrent calls could each pass the!state.exchangeTokenPromisecheck before any of them had set the promise, resulting in redundantexchangeToken()network requests.Changes
await getDebugToken()call before theif (!state.exchangeTokenPromise)check to ensure token preparation occurs before promise coordination logic.state.exchangeTokenPromiseimmediately, ensuring concurrent calls share the same in-flight promise.Notes
Resolved #9184