Skip to content

Promise never resolves when performing an action on a Firestore DB after calling auth.createUserWithEmailAndPassword #3218

@nefarioustim

Description

@nefarioustim
  • Operating System version: MacOS Mojave 10.14.6
  • Browser version: Firefox 78, Chrome 84, Safari 13.1.1
  • Firebase SDK version: 7.15
  • Firebase Product: auth, firestore

When attempting to follow a call to auth.createUserWithEmailAndPassword with code that updates or creates a Firestore document (in my initial case it was a firestore.collection().doc().set(), but in testing it was the same for an .update()), the returning Promise never resolves and simply hangs.

Here is a simplified example of the Vuex actions I am calling in my code that exhibit this issue:

    signUserUp ({ dispatch, commit }, payload) {
      const $app = this.$app
      commit('setLoading', true)
      commit('clearError')

      return fb.auth
        .createUserWithEmailAndPassword(payload.email, payload.password)
        .then(userRef => {
          $app.logInfo('Created auth user', {'email': payload.email})

          return dispatch("createAccount", payload)
        })
        .catch(error => {
          commit('setLoading', false)
          commit('setError', error)
          $app.logError('Error signing up user', {error: error.message})
        })
    },

    createAccount({ commit, dispatch }, payload) {
      const $app = this.$app
      return fb.db.collection(COLLECTION)
        .doc(payload.account)
        .set({
          'created': new Date().getTime(),
          'updated': new Date().getTime(),
          'active': true,
          'account': payload.account,
          'legalName': payload.legalName,
          'country': payload.country,
          'currency': payload.currency,
          'industry': payload.industry,
          'email': payload.busemail || payload.email, // Allow for signup form
          'about': payload.about,
          'tags': payload.tags,
          'type': payload.type
        })
        .catch(error => {
          commit('setLoading', false)
          commit('setError', error)
          $app.logError('Error creating account', {error: error.message})
        })
    }

I have managed to temporarily resolve this issue by rolling back to version 7.14 of the SDK, but obviously I'm interested in a more longterm fix that allows me to continue upgrading the SDK.

Possible related to #3120 and raised following comments there.

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions