nuxt-community / firebase-module

🔥 Easily integrate Firebase into your Nuxt project. 🔥
https://firebase.nuxtjs.org
MIT License
641 stars 98 forks source link

Nuxt firebase module always get ERR_CONNECTION_REFUSED when use the this.$fire.auth.createUserWithEmailAndPassword(email, password) #428

Closed silvesterwali closed 3 years ago

silvesterwali commented 3 years ago

i have follow along the documentation on https://firebase.nuxtjs.org/ but when try to use the this.$fire.auth.createUserWithEmailAndPassword(email, password) i got same error like below image

here is my code

  async userRegister({ email, password }) {
      try {
        this.error = null
        this.set_loding(true)
        await this.$fire.auth.createUserWithEmailAndPassword(email, password)
        this.$nuxt.$loading.finish()
        this.$router.push('/')
      } catch (err) {
        this.set_loding(false)
        this.$nuxt.$loading.finish()
        this.alert = true
        this.error = err.message
      }
    },

and my nuxt config is

  // Modules (https://go.nuxtjs.dev/config-modules)
  modules: [
    // https://go.nuxtjs.dev/axios
    '@nuxtjs/axios',
    // https://go.nuxtjs.dev/pwa
    '@nuxtjs/pwa',
    [
      '@nuxtjs/firebase',
      {
        config: {
          apiKey: 'AIzaSyAbNgYuLlj2ZakG....................',
          authDomain: 'XXXXXXXXXXX',
          databaseURL: 'https://porfolio-ab27c-default-rtdb.firebaseio.com',
          projectId: 'XXXXXX',
          storageBucket: 'XXXXX',
          messagingSenderId: 'XXXXXXX',
          appId: '1:55587078347:web:77e5a962c398b2864e5b4e',
          measurementId: 'G-P....',
        },
        /** @see https://firebase.nuxtjs.org/guide/options */
        services: {
          /** @see https://firebase.nuxtjs.org/service-options/auth/ */
          auth: {
            persisten:
              'local' /** @see https://firebase.google.com/docs/auth/web/auth-state-persistence */,
            initialize: {
              onAuthStateChangedMutation: 'ON_AUTH_STATE_CHANGED_MUTATION',
              onAuthStateChangedAction: 'onAuthStateChangedAction',
              subscribeManually: false,
            },
            ssr: false, // default
            emulatorPort:
              process.env.NODE_ENV === 'development' ? 9099 : undefined,
            emulatorHost: 'http://localhost',
            disableEmulatorWarnings: true,
          },
          firestore: true,
          database: false,
          performance: false,
          analytics: true,
          remoteConfig: true,
        },
      },
    ],
  ],

sorry for my english and thanks so much for your replay

silvesterwali commented 3 years ago

i found the solusion ...in my firebase pannel not use port on develoment mode
so is set the emulator port toemulatorPort:undifined