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

Fix for authStateReady for FirebaseServerApp #8085

Merged
merged 4 commits into from
Mar 20, 2024

Conversation

jamesdaniels
Copy link
Member

@jamesdaniels jamesdaniels commented Mar 19, 2024

It turns out the FirebaseServerApp implementation in #8005 was not blocking auth initialization, so when testing end-to-end we were seeing race conditions with auth state. In this PR I address by awaiting the user fetch and moving the implementation into AuthImpl#initializeCurrentUser for cleanliness.

Mind taking a look @renkelvin?

Copy link

changeset-bot bot commented Mar 19, 2024

⚠️ No Changeset found

Latest commit: 5090091

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

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

@jamesdaniels jamesdaniels changed the title Fix? Possible fix for onAuthStateReady for FirebaseServerApp Mar 19, 2024
@jamesdaniels jamesdaniels changed the title Possible fix for onAuthStateReady for FirebaseServerApp Possible fix for authStateReady for FirebaseServerApp Mar 19, 2024
@google-oss-bot
Copy link
Contributor

google-oss-bot commented Mar 19, 2024

Size Report 1

Affected Products

  • @firebase/auth

    TypeBase (003b3c7)Merge (4df6474)Diff
    cordova209 kB210 kB+30 B (+0.0%)
    esm5236 kB236 kB+30 B (+0.0%)
    main179 kB179 kB+20 B (+0.0%)
    react-native199 kB199 kB+12 B (+0.0%)
  • @firebase/auth/cordova

    TypeBase (003b3c7)Merge (4df6474)Diff
    browser209 kB210 kB+30 B (+0.0%)
    module209 kB210 kB+30 B (+0.0%)
  • @firebase/auth/internal

    TypeBase (003b3c7)Merge (4df6474)Diff
    esm5250 kB250 kB+30 B (+0.0%)
    main215 kB215 kB+10 B (+0.0%)
  • @firebase/auth/web-extension

    TypeBase (003b3c7)Merge (4df6474)Diff
    main152 kB152 kB-18 B (-0.0%)
  • bundle

    TypeBase (003b3c7)Merge (4df6474)Diff
    auth (Anonymous)75.9 kB76.0 kB+99 B (+0.1%)
    auth (EmailAndPassword)84.2 kB84.3 kB+99 B (+0.1%)
    auth (GoogleFBTwitterGitHubPopup)103 kB103 kB+99 B (+0.1%)
    auth (GooglePopup)100 kB100 kB+99 B (+0.1%)
    auth (GoogleRedirect)100 kB101 kB+99 B (+0.1%)
    auth (Phone)86.5 kB86.6 kB+99 B (+0.1%)
  • firebase

    TypeBase (003b3c7)Merge (4df6474)Diff
    firebase-auth-compat.js139 kB140 kB+474 B (+0.3%)
    firebase-auth-cordova.js177 kB177 kB+69 B (+0.0%)
    firebase-auth-web-extension.js117 kB117 kB+62 B (+0.1%)
    firebase-auth.js151 kB151 kB+62 B (+0.0%)
    firebase-compat.js784 kB785 kB+474 B (+0.1%)

Test Logs

  1. https://storage.googleapis.com/firebase-sdk-metric-reports/v8kwlC3xIJ.html

@google-oss-bot
Copy link
Contributor

google-oss-bot commented Mar 19, 2024

Size Analysis Report 1

Affected Products

  • @firebase/auth

    • ActionCodeOperation

      Size

      TypeBase (003b3c7)Merge (4df6474)Diff
      size38.9 kB39.4 kB+493 B (+1.3%)
      size-with-ext-deps60.4 kB60.9 kB+494 B (+0.8%)
    • ActionCodeURL

      Size

      TypeBase (003b3c7)Merge (4df6474)Diff
      size39.8 kB40.2 kB+493 B (+1.2%)
      size-with-ext-deps61.5 kB62.0 kB+494 B (+0.8%)
    • AuthCredential

      Size

      TypeBase (003b3c7)Merge (4df6474)Diff
      size38.9 kB39.4 kB+493 B (+1.3%)
      size-with-ext-deps60.4 kB60.9 kB+494 B (+0.8%)
    • AuthErrorCodes

      Size

      TypeBase (003b3c7)Merge (4df6474)Diff
      size43.8 kB44.3 kB+493 B (+1.1%)
      size-with-ext-deps65.3 kB65.8 kB+494 B (+0.8%)
    • EmailAuthCredential

      Size

      TypeBase (003b3c7)Merge (4df6474)Diff
      size44.7 kB45.1 kB+494 B (+1.1%)
      size-with-ext-deps66.1 kB66.6 kB+494 B (+0.7%)
    • EmailAuthProvider

      Size

      TypeBase (003b3c7)Merge (4df6474)Diff
      size46.1 kB46.6 kB+494 B (+1.1%)
      size-with-ext-deps67.8 kB68.3 kB+494 B (+0.7%)
    • FacebookAuthProvider

      Size

      TypeBase (003b3c7)Merge (4df6474)Diff
      size43.7 kB44.2 kB+493 B (+1.1%)
      size-with-ext-deps65.2 kB65.7 kB+494 B (+0.8%)
    • FactorId

      Size

      TypeBase (003b3c7)Merge (4df6474)Diff
      size38.7 kB39.2 kB+493 B (+1.3%)
      size-with-ext-deps60.2 kB60.7 kB+494 B (+0.8%)
    • GithubAuthProvider

      Size

      TypeBase (003b3c7)Merge (4df6474)Diff
      size43.7 kB44.2 kB+493 B (+1.1%)
      size-with-ext-deps65.2 kB65.7 kB+494 B (+0.8%)
    • GoogleAuthProvider

      Size

      TypeBase (003b3c7)Merge (4df6474)Diff
      size43.7 kB44.2 kB+493 B (+1.1%)
      size-with-ext-deps65.2 kB65.7 kB+494 B (+0.8%)
    • OAuthCredential

      Size

      TypeBase (003b3c7)Merge (4df6474)Diff
      size40.8 kB41.3 kB+493 B (+1.2%)
      size-with-ext-deps62.3 kB62.8 kB+494 B (+0.8%)
    • OAuthProvider

      Size

      TypeBase (003b3c7)Merge (4df6474)Diff
      size44.7 kB45.2 kB+493 B (+1.1%)
      size-with-ext-deps66.1 kB66.6 kB+494 B (+0.7%)
    • OperationType

      Size

      TypeBase (003b3c7)Merge (4df6474)Diff
      size38.7 kB39.2 kB+493 B (+1.3%)
      size-with-ext-deps60.2 kB60.7 kB+494 B (+0.8%)
    • PhoneAuthCredential

      Size

      TypeBase (003b3c7)Merge (4df6474)Diff
      size40.8 kB41.3 kB+493 B (+1.2%)
      size-with-ext-deps62.3 kB62.8 kB+494 B (+0.8%)
    • PhoneAuthProvider

      Size

      TypeBase (003b3c7)Merge (4df6474)Diff
      size42.5 kB43.0 kB+493 B (+1.2%)
      size-with-ext-deps64.0 kB64.5 kB+494 B (+0.8%)
    • PhoneMultiFactorGenerator

      Size

      TypeBase (003b3c7)Merge (4df6474)Diff
      size39.5 kB40.0 kB+493 B (+1.2%)
      size-with-ext-deps61.0 kB61.5 kB+494 B (+0.8%)
    • ProviderId

      Size

      TypeBase (003b3c7)Merge (4df6474)Diff
      size38.8 kB39.3 kB+493 B (+1.3%)
      size-with-ext-deps60.3 kB60.7 kB+494 B (+0.8%)
    • RecaptchaVerifier

      Size

      TypeBase (003b3c7)Merge (4df6474)Diff
      size45.6 kB46.1 kB+493 B (+1.1%)
      size-with-ext-deps67.1 kB67.6 kB+494 B (+0.7%)
    • SAMLAuthProvider

      Size

      TypeBase (003b3c7)Merge (4df6474)Diff
      size45.0 kB45.5 kB+493 B (+1.1%)
      size-with-ext-deps66.5 kB67.0 kB+494 B (+0.7%)
    • SignInMethod

      Size

      TypeBase (003b3c7)Merge (4df6474)Diff
      size38.8 kB39.3 kB+493 B (+1.3%)
      size-with-ext-deps60.3 kB60.8 kB+494 B (+0.8%)
    • TotpMultiFactorGenerator

      Size

      TypeBase (003b3c7)Merge (4df6474)Diff
      size41.2 kB41.7 kB+493 B (+1.2%)
      size-with-ext-deps62.7 kB63.2 kB+494 B (+0.8%)
    • TotpSecret

      Size

      TypeBase (003b3c7)Merge (4df6474)Diff
      size39.6 kB40.1 kB+493 B (+1.2%)
      size-with-ext-deps61.1 kB61.6 kB+494 B (+0.8%)
    • TwitterAuthProvider

      Size

      TypeBase (003b3c7)Merge (4df6474)Diff
      size43.7 kB44.2 kB+493 B (+1.1%)
      size-with-ext-deps65.2 kB65.7 kB+494 B (+0.8%)
    • applyActionCode

      Size

      TypeBase (003b3c7)Merge (4df6474)Diff
      size38.8 kB39.3 kB+493 B (+1.3%)
      size-with-ext-deps60.3 kB60.7 kB+494 B (+0.8%)
    • beforeAuthStateChanged

      Size

      TypeBase (003b3c7)Merge (4df6474)Diff
      size38.7 kB39.2 kB+493 B (+1.3%)
      size-with-ext-deps60.2 kB60.7 kB+494 B (+0.8%)
    • browserLocalPersistence

      Size

      TypeBase (003b3c7)Merge (4df6474)Diff
      size42.1 kB42.6 kB+493 B (+1.2%)
      size-with-ext-deps63.6 kB64.1 kB+494 B (+0.8%)
    • browserPopupRedirectResolver

      Size

      TypeBase (003b3c7)Merge (4df6474)Diff
      size63.6 kB64.1 kB+493 B (+0.8%)
      size-with-ext-deps85.3 kB85.8 kB+494 B (+0.6%)
    • browserSessionPersistence

      Size

      TypeBase (003b3c7)Merge (4df6474)Diff
      size42.1 kB42.6 kB+493 B (+1.2%)
      size-with-ext-deps63.6 kB64.1 kB+494 B (+0.8%)
    • checkActionCode

      Size

      TypeBase (003b3c7)Merge (4df6474)Diff
      size39.9 kB40.4 kB+493 B (+1.2%)
      size-with-ext-deps61.4 kB61.9 kB+494 B (+0.8%)
    • confirmPasswordReset

      Size

      TypeBase (003b3c7)Merge (4df6474)Diff
      size39.0 kB39.5 kB+493 B (+1.3%)
      size-with-ext-deps60.5 kB61.0 kB+494 B (+0.8%)
    • connectAuthEmulator

      Size

      TypeBase (003b3c7)Merge (4df6474)Diff
      size40.4 kB40.9 kB+493 B (+1.2%)
      size-with-ext-deps61.9 kB62.4 kB+494 B (+0.8%)
    • createUserWithEmailAndPassword

      Size

      TypeBase (003b3c7)Merge (4df6474)Diff
      size43.8 kB44.3 kB+494 B (+1.1%)
      size-with-ext-deps65.3 kB65.8 kB+494 B (+0.8%)
    • debugErrorMap

      Size

      TypeBase (003b3c7)Merge (4df6474)Diff
      size50.9 kB51.4 kB+493 B (+1.0%)
      size-with-ext-deps72.4 kB72.8 kB+494 B (+0.7%)
    • deleteUser

      Size

      TypeBase (003b3c7)Merge (4df6474)Diff
      size38.7 kB39.2 kB+493 B (+1.3%)
      size-with-ext-deps60.2 kB60.7 kB+494 B (+0.8%)
    • fetchSignInMethodsForEmail

      Size

      TypeBase (003b3c7)Merge (4df6474)Diff
      size39.0 kB39.5 kB+493 B (+1.3%)
      size-with-ext-deps60.5 kB61.0 kB+494 B (+0.8%)
    • getAdditionalUserInfo

      Size

      TypeBase (003b3c7)Merge (4df6474)Diff
      size40.0 kB40.5 kB+493 B (+1.2%)
      size-with-ext-deps61.5 kB62.0 kB+494 B (+0.8%)
    • getAuth

      Size

      TypeBase (003b3c7)Merge (4df6474)Diff
      size74.1 kB74.2 kB+100 B (+0.1%)
      size-with-ext-deps102 kB102 kB+99 B (+0.1%)

      Dependency

      TypeBase (003b3c7)Merge (4df6474)Diff
      functions

      120 dependencies

      _addTidIfNecessary
      _allSettled
      _assert
      _castAuth
      _createError
      _deleteDatabase
      _deleteObject
      _emulatorUrl
      _errorWithCustomMessage
      _fail
      _gapiScriptUrl
      _generateCallbackName
      _generateEventId
      _getActiveServiceWorker
      _getAndClearPendingRedirectStatus
      _getBrowserName
      _getClientVersion
      _getCurrentScheme
      _getCurrentUrl
      _getFinalTarget
      _getInstance
      _getPasswordPolicy
      _getProjectConfig
      _getRedirectResult
      _getRedirectUrl
      _getServiceWorkerController
      _getUserLanguage
      _getWorkerGlobalScope
      _iframeCannotSyncWebStorage
      _initializeAuthInstance
      _isAndroid
      _isBlackBerry
      _isChromeIOS
      _isFirefox
      _isHttpOrHttps
      _isIE10
      _isIEMobile
      _isIOS
      _isIOSStandalone
      _isIframe
      _isMobileBrowser
      _isOnline
      _isSafari
      _isWebOS
      _isWorker
      _link
      _link$1
      _loadGapi
      _loadJS
      _loadUserFromIdToken
      _logError
      _logWarn
      _logoutIfInvalidated
      _makeTaggedError
      _open
      _openDatabase
      _openIframe
      _overrideRedirectResult
      _parseToken
      _performApiRequest
      _performFetchWithErrorHandling
      _performSignInRequest
      _persistenceKeyName
      _processCredentialSavingMfaContextIfNecessary
      _prodErrorMap
      _putObject
      _reauth
      _reauthenticate
      _reloadWithoutSaving
      _serverAppCurrentUserOperationNotSupportedError
      _setExternalJSProvider
      _setWindowLocation
      _signIn
      _signInWithCredential
      _tokenExpiresIn
      _validateOrigin
      _window
      _withDefaultResolver
      assertStringOrUndefined
      beforeAuthStateChanged
      connectAuthEmulator
      createErrorInternal
      debugAssert
      debugFail
      deleteAccount
      emitEmulatorWarning
      eventUid
      extractHostAndPort
      extractProtocol
      extractProviderData
      getAccountInfo
      getAuth
      getHandlerBase
      getIdTokenResult
      getIframeUrl
      getObject
      getObjectStore
      getScriptParentElement
      getVersionForPlatform
      initializeAuth
      isNullRedirectEvent
      isRedirectEvent
      isUserInvalidated
      loadGapi
      matchDomain
      mergeProviderData
      onIdTokenChanged
      openAsNewWindowIOS
      parsePort
      pendingRedirectKey
      providerIdForResponse
      registerAuth
      reload
      requestStsToken
      resetUnloadedGapiModules
      resolverPersistence
      revokeToken
      secondsStringToMilliseconds
      signInWithIdp
      utcTimestampToDateString

      119 dependencies

      _addTidIfNecessary
      _allSettled
      _assert
      _castAuth
      _createError
      _deleteDatabase
      _deleteObject
      _emulatorUrl
      _errorWithCustomMessage
      _fail
      _gapiScriptUrl
      _generateCallbackName
      _generateEventId
      _getActiveServiceWorker
      _getAndClearPendingRedirectStatus
      _getBrowserName
      _getClientVersion
      _getCurrentScheme
      _getCurrentUrl
      _getFinalTarget
      _getInstance
      _getPasswordPolicy
      _getProjectConfig
      _getRedirectResult
      _getRedirectUrl
      _getServiceWorkerController
      _getUserLanguage
      _getWorkerGlobalScope
      _iframeCannotSyncWebStorage
      _initializeAuthInstance
      _isAndroid
      _isBlackBerry
      _isChromeIOS
      _isFirefox
      _isHttpOrHttps
      _isIE10
      _isIEMobile
      _isIOS
      _isIOSStandalone
      _isIframe
      _isMobileBrowser
      _isOnline
      _isSafari
      _isWebOS
      _isWorker
      _link
      _link$1
      _loadGapi
      _loadJS
      _logError
      _logWarn
      _logoutIfInvalidated
      _makeTaggedError
      _open
      _openDatabase
      _openIframe
      _overrideRedirectResult
      _parseToken
      _performApiRequest
      _performFetchWithErrorHandling
      _performSignInRequest
      _persistenceKeyName
      _processCredentialSavingMfaContextIfNecessary
      _prodErrorMap
      _putObject
      _reauth
      _reauthenticate
      _reloadWithoutSaving
      _serverAppCurrentUserOperationNotSupportedError
      _setExternalJSProvider
      _setWindowLocation
      _signIn
      _signInWithCredential
      _tokenExpiresIn
      _validateOrigin
      _window
      _withDefaultResolver
      assertStringOrUndefined
      beforeAuthStateChanged
      connectAuthEmulator
      createErrorInternal
      debugAssert
      debugFail
      deleteAccount
      emitEmulatorWarning
      eventUid
      extractHostAndPort
      extractProtocol
      extractProviderData
      getAccountInfo
      getAuth
      getHandlerBase
      getIdTokenResult
      getIframeUrl
      getObject
      getObjectStore
      getScriptParentElement
      getVersionForPlatform
      initializeAuth
      isNullRedirectEvent
      isRedirectEvent
      isUserInvalidated
      loadGapi
      matchDomain
      mergeProviderData
      onIdTokenChanged
      openAsNewWindowIOS
      parsePort
      pendingRedirectKey
      providerIdForResponse
      registerAuth
      reload
      requestStsToken
      resetUnloadedGapiModules
      resolverPersistence
      revokeToken
      secondsStringToMilliseconds
      signInWithIdp
      utcTimestampToDateString

      - _loadUserFromIdToken

    • getIdToken

      Size

      TypeBase (003b3c7)Merge (4df6474)Diff
      size38.7 kB39.2 kB+493 B (+1.3%)
      size-with-ext-deps60.2 kB60.7 kB+494 B (+0.8%)
    • getIdTokenResult

      Size

      TypeBase (003b3c7)Merge (4df6474)Diff
      size38.7 kB39.2 kB+493 B (+1.3%)
      size-with-ext-deps60.1 kB60.6 kB+494 B (+0.8%)
    • getMultiFactorResolver

      Size

      TypeBase (003b3c7)Merge (4df6474)Diff
      size41.6 kB42.1 kB+493 B (+1.2%)
      size-with-ext-deps63.0 kB63.5 kB+494 B (+0.8%)
    • getRedirectResult

      Size

      TypeBase (003b3c7)Merge (4df6474)Diff
      size46.3 kB46.8 kB+493 B (+1.1%)
      size-with-ext-deps67.8 kB68.3 kB+494 B (+0.7%)
    • inMemoryPersistence

      Size

      TypeBase (003b3c7)Merge (4df6474)Diff
      size38.7 kB39.2 kB+493 B (+1.3%)
      size-with-ext-deps60.1 kB60.6 kB+494 B (+0.8%)
    • indexedDBLocalPersistence

      Size

      TypeBase (003b3c7)Merge (4df6474)Diff
      size46.1 kB46.6 kB+493 B (+1.1%)
      size-with-ext-deps67.6 kB68.1 kB+494 B (+0.7%)
    • initializeAuth

      Size

      TypeBase (003b3c7)Merge (4df6474)Diff
      size39.3 kB39.4 kB+100 B (+0.3%)
      size-with-ext-deps61.3 kB61.4 kB+99 B (+0.2%)

      Dependency

      TypeBase (003b3c7)Merge (4df6474)Diff
      functions

      55 dependencies

      _addTidIfNecessary
      _assert
      _castAuth
      _createError
      _emulatorUrl
      _errorWithCustomMessage
      _fail
      _getBrowserName
      _getClientVersion
      _getCurrentScheme
      _getFinalTarget
      _getInstance
      _getPasswordPolicy
      _getUserLanguage
      _initializeAuthInstance
      _isAndroid
      _isBlackBerry
      _isChromeIOS
      _isFirefox
      _isHttpOrHttps
      _isIEMobile
      _isOnline
      _isSafari
      _isWebOS
      _loadUserFromIdToken
      _logError
      _logWarn
      _logoutIfInvalidated
      _makeTaggedError
      _parseToken
      _performApiRequest
      _performFetchWithErrorHandling
      _persistenceKeyName
      _prodErrorMap
      _reloadWithoutSaving
      _serverAppCurrentUserOperationNotSupportedError
      _tokenExpiresIn
      assertStringOrUndefined
      createErrorInternal
      debugAssert
      debugFail
      deleteAccount
      extractProviderData
      getAccountInfo
      getIdTokenResult
      getVersionForPlatform
      initializeAuth
      isUserInvalidated
      mergeProviderData
      registerAuth
      reload
      requestStsToken
      revokeToken
      secondsStringToMilliseconds
      utcTimestampToDateString

      54 dependencies

      _addTidIfNecessary
      _assert
      _castAuth
      _createError
      _emulatorUrl
      _errorWithCustomMessage
      _fail
      _getBrowserName
      _getClientVersion
      _getCurrentScheme
      _getFinalTarget
      _getInstance
      _getPasswordPolicy
      _getUserLanguage
      _initializeAuthInstance
      _isAndroid
      _isBlackBerry
      _isChromeIOS
      _isFirefox
      _isHttpOrHttps
      _isIEMobile
      _isOnline
      _isSafari
      _isWebOS
      _logError
      _logWarn
      _logoutIfInvalidated
      _makeTaggedError
      _parseToken
      _performApiRequest
      _performFetchWithErrorHandling
      _persistenceKeyName
      _prodErrorMap
      _reloadWithoutSaving
      _serverAppCurrentUserOperationNotSupportedError
      _tokenExpiresIn
      assertStringOrUndefined
      createErrorInternal
      debugAssert
      debugFail
      deleteAccount
      extractProviderData
      getAccountInfo
      getIdTokenResult
      getVersionForPlatform
      initializeAuth
      isUserInvalidated
      mergeProviderData
      registerAuth
      reload
      requestStsToken
      revokeToken
      secondsStringToMilliseconds
      utcTimestampToDateString

      - _loadUserFromIdToken

    • initializeRecaptchaConfig

      Size

      TypeBase (003b3c7)Merge (4df6474)Diff
      size42.0 kB42.5 kB+493 B (+1.2%)
      size-with-ext-deps63.5 kB64.0 kB+494 B (+0.8%)
    • isSignInWithEmailLink

      Size

      TypeBase (003b3c7)Merge (4df6474)Diff
      size39.9 kB40.4 kB+493 B (+1.2%)
      size-with-ext-deps61.6 kB62.1 kB+494 B (+0.8%)
    • linkWithCredential

      Size

      TypeBase (003b3c7)Merge (4df6474)Diff
      size39.7 kB40.2 kB+493 B (+1.2%)
      size-with-ext-deps61.2 kB61.7 kB+494 B (+0.8%)
    • linkWithPhoneNumber

      Size

      TypeBase (003b3c7)Merge (4df6474)Diff
      size43.3 kB43.7 kB+493 B (+1.1%)
      size-with-ext-deps64.7 kB65.2 kB+494 B (+0.8%)
    • linkWithPopup

      Size

      TypeBase (003b3c7)Merge (4df6474)Diff
      size49.9 kB50.4 kB+493 B (+1.0%)
      size-with-ext-deps71.4 kB71.9 kB+494 B (+0.7%)
    • linkWithRedirect

      Size

      TypeBase (003b3c7)Merge (4df6474)Diff
      size45.0 kB45.5 kB+493 B (+1.1%)
      size-with-ext-deps66.5 kB67.0 kB+494 B (+0.7%)
    • multiFactor

      Size

      TypeBase (003b3c7)Merge (4df6474)Diff
      size40.9 kB41.4 kB+493 B (+1.2%)
      size-with-ext-deps62.4 kB62.8 kB+494 B (+0.8%)
    • onAuthStateChanged

      Size

      TypeBase (003b3c7)Merge (4df6474)Diff
      size38.7 kB39.2 kB+493 B (+1.3%)
      size-with-ext-deps60.2 kB60.7 kB+494 B (+0.8%)
    • onIdTokenChanged

      Size

      TypeBase (003b3c7)Merge (4df6474)Diff
      size38.7 kB39.2 kB+493 B (+1.3%)
      size-with-ext-deps60.2 kB60.7 kB+494 B (+0.8%)
    • parseActionCodeURL

      Size

      TypeBase (003b3c7)Merge (4df6474)Diff
      size39.8 kB40.3 kB+493 B (+1.2%)
      size-with-ext-deps61.5 kB62.0 kB+494 B (+0.8%)
    • prodErrorMap

      Size

      TypeBase (003b3c7)Merge (4df6474)Diff
      size38.7 kB39.1 kB+493 B (+1.3%)
      size-with-ext-deps60.1 kB60.6 kB+494 B (+0.8%)
    • reauthenticateWithCredential

      Size

      TypeBase (003b3c7)Merge (4df6474)Diff
      size40.3 kB40.8 kB+493 B (+1.2%)
      size-with-ext-deps61.8 kB62.3 kB+494 B (+0.8%)
    • reauthenticateWithPhoneNumber

      Size

      TypeBase (003b3c7)Merge (4df6474)Diff
      size43.9 kB44.4 kB+493 B (+1.1%)
      size-with-ext-deps65.4 kB65.9 kB+494 B (+0.8%)
    • reauthenticateWithPopup

      Size

      TypeBase (003b3c7)Merge (4df6474)Diff
      size50.0 kB50.5 kB+493 B (+1.0%)
      size-with-ext-deps71.5 kB72.0 kB+494 B (+0.7%)
    • reauthenticateWithRedirect

      Size

      TypeBase (003b3c7)Merge (4df6474)Diff
      size44.8 kB45.3 kB+493 B (+1.1%)
      size-with-ext-deps66.3 kB66.8 kB+494 B (+0.7%)
    • reload

      Size

      TypeBase (003b3c7)Merge (4df6474)Diff
      size38.6 kB39.1 kB+493 B (+1.3%)
      size-with-ext-deps60.1 kB60.6 kB+494 B (+0.8%)
    • revokeAccessToken

      Size

      TypeBase (003b3c7)Merge (4df6474)Diff
      size38.7 kB39.2 kB+493 B (+1.3%)
      size-with-ext-deps60.2 kB60.7 kB+494 B (+0.8%)
    • sendEmailVerification

      Size

      TypeBase (003b3c7)Merge (4df6474)Diff
      size39.6 kB40.1 kB+493 B (+1.2%)
      size-with-ext-deps61.1 kB61.6 kB+494 B (+0.8%)
    • sendPasswordResetEmail

      Size

      TypeBase (003b3c7)Merge (4df6474)Diff
      size43.4 kB43.9 kB+493 B (+1.1%)
      size-with-ext-deps64.9 kB65.4 kB+494 B (+0.8%)
    • sendSignInLinkToEmail

      Size

      TypeBase (003b3c7)Merge (4df6474)Diff
      size43.5 kB43.9 kB+493 B (+1.1%)
      size-with-ext-deps64.9 kB65.4 kB+494 B (+0.8%)
    • setPersistence

      Size

      TypeBase (003b3c7)Merge (4df6474)Diff
      size38.7 kB39.2 kB+493 B (+1.3%)
      size-with-ext-deps60.2 kB60.7 kB+494 B (+0.8%)
    • signInAnonymously

      Size

      TypeBase (003b3c7)Merge (4df6474)Diff
      size39.9 kB40.4 kB+493 B (+1.2%)
      size-with-ext-deps61.3 kB61.8 kB+494 B (+0.8%)
    • signInWithCredential

      Size

      TypeBase (003b3c7)Merge (4df6474)Diff
      size40.1 kB40.6 kB+493 B (+1.2%)
      size-with-ext-deps61.6 kB62.1 kB+494 B (+0.8%)
    • signInWithCustomToken

      Size

      TypeBase (003b3c7)Merge (4df6474)Diff
      size39.7 kB40.2 kB+493 B (+1.2%)
      size-with-ext-deps61.2 kB61.7 kB+494 B (+0.8%)
    • signInWithEmailAndPassword

      Size

      TypeBase (003b3c7)Merge (4df6474)Diff
      size47.8 kB48.3 kB+494 B (+1.0%)
      size-with-ext-deps69.6 kB70.1 kB+494 B (+0.7%)
    • signInWithEmailLink

      Size

      TypeBase (003b3c7)Merge (4df6474)Diff
      size47.8 kB48.3 kB+494 B (+1.0%)
      size-with-ext-deps69.6 kB70.1 kB+494 B (+0.7%)
    • signInWithPhoneNumber

      Size

      TypeBase (003b3c7)Merge (4df6474)Diff
      size43.7 kB44.2 kB+493 B (+1.1%)
      size-with-ext-deps65.2 kB65.6 kB+494 B (+0.8%)
    • signInWithPopup

      Size

      TypeBase (003b3c7)Merge (4df6474)Diff
      size49.9 kB50.4 kB+493 B (+1.0%)
      size-with-ext-deps71.4 kB71.9 kB+494 B (+0.7%)
    • signInWithRedirect

      Size

      TypeBase (003b3c7)Merge (4df6474)Diff
      size44.5 kB45.0 kB+493 B (+1.1%)
      size-with-ext-deps66.0 kB66.5 kB+494 B (+0.7%)
    • signOut

      Size

      TypeBase (003b3c7)Merge (4df6474)Diff
      size38.7 kB39.2 kB+493 B (+1.3%)
      size-with-ext-deps60.2 kB60.7 kB+494 B (+0.8%)
    • unlink

      Size

      TypeBase (003b3c7)Merge (4df6474)Diff
      size39.3 kB39.8 kB+493 B (+1.3%)
      size-with-ext-deps60.7 kB61.2 kB+494 B (+0.8%)
    • updateCurrentUser

      Size

      TypeBase (003b3c7)Merge (4df6474)Diff
      size38.7 kB39.2 kB+493 B (+1.3%)
      size-with-ext-deps60.2 kB60.7 kB+494 B (+0.8%)
    • updateEmail

      Size

      TypeBase (003b3c7)Merge (4df6474)Diff
      size39.0 kB39.5 kB+493 B (+1.3%)
      size-with-ext-deps60.5 kB61.0 kB+494 B (+0.8%)
    • updatePassword

      Size

      TypeBase (003b3c7)Merge (4df6474)Diff
      size39.0 kB39.5 kB+493 B (+1.3%)
      size-with-ext-deps60.5 kB60.9 kB+494 B (+0.8%)
    • updatePhoneNumber

      Size

      TypeBase (003b3c7)Merge (4df6474)Diff
      size39.5 kB40.0 kB+493 B (+1.2%)
      size-with-ext-deps61.0 kB61.5 kB+494 B (+0.8%)
    • updateProfile

      Size

      TypeBase (003b3c7)Merge (4df6474)Diff
      size39.2 kB39.7 kB+493 B (+1.3%)
      size-with-ext-deps60.6 kB61.1 kB+494 B (+0.8%)
    • useDeviceLanguage

      Size

      TypeBase (003b3c7)Merge (4df6474)Diff
      size38.7 kB39.2 kB+493 B (+1.3%)
      size-with-ext-deps60.2 kB60.7 kB+494 B (+0.8%)
    • validatePassword

      Size

      TypeBase (003b3c7)Merge (4df6474)Diff
      size38.7 kB39.2 kB+493 B (+1.3%)
      size-with-ext-deps60.2 kB60.7 kB+494 B (+0.8%)
    • verifyBeforeUpdateEmail

      Size

      TypeBase (003b3c7)Merge (4df6474)Diff
      size39.6 kB40.1 kB+493 B (+1.2%)
      size-with-ext-deps61.1 kB61.6 kB+494 B (+0.8%)
    • verifyPasswordResetCode

      Size

      TypeBase (003b3c7)Merge (4df6474)Diff
      size40.0 kB40.5 kB+493 B (+1.2%)
      size-with-ext-deps61.4 kB61.9 kB+494 B (+0.8%)

Test Logs

  1. https://storage.googleapis.com/firebase-sdk-metric-reports/D2PkeYECCL.html

@jamesdaniels jamesdaniels marked this pull request as ready for review March 19, 2024 20:41
@jamesdaniels jamesdaniels changed the title Possible fix for authStateReady for FirebaseServerApp Fix for authStateReady for FirebaseServerApp Mar 19, 2024
@jamesdaniels jamesdaniels requested review from DellaBitta and renkelvin and removed request for a team, renkelvin, sam-gc, lisajian and Xiaoshouzi-gh March 19, 2024 20:43
response,
idToken
);
await this.directlySetCurrentUser(user);

Choose a reason for hiding this comment

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

Why use directlySetCurrentUser instead of updateCurrentUser? directlySetCurrentUser is rarely used.

Copy link
Member Author

@jamesdaniels jamesdaniels Mar 20, 2024

Choose a reason for hiding this comment

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

I noted that directlySetCurrentUser was what was being used elsewhere in initializeCurrentUser where I am calling this from. FWIW we have chosen to disable updateCurrentUser in FirebaseServerApp. I could use _updateCurrentUser as @DellaBitta did before but I was concerned that the side effects of notifying listeners and running middleware were undesirable during auth initialization and may lead to more race conditions and ill effects in developer's code.

Copy link
Member Author

Choose a reason for hiding this comment

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

Perhaps I should rename this method, as it is more appropriately initializeCurrentUserFromIdToken

Copy link
Contributor

Choose a reason for hiding this comment

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

seconded the rename.

Copy link
Member Author

Choose a reason for hiding this comment

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

Renamed.

Choose a reason for hiding this comment

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

Yeah, the concern of side effects of _updateCurrentUser makes sense to me. Thanks, let's keep directlySetCurrentUser then.

response,
idToken
);
await this.directlySetCurrentUser(user);

Choose a reason for hiding this comment

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

Yeah, the concern of side effects of _updateCurrentUser makes sense to me. Thanks, let's keep directlySetCurrentUser then.

@DellaBitta DellaBitta merged commit eabee1a into feature-firebaseserverapp Mar 20, 2024
41 checks passed
@DellaBitta DellaBitta deleted the jamesdanielsFSAonAuthStateReady branch March 20, 2024 21:35
@firebase firebase locked and limited conversation to collaborators Apr 20, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants