Skip to content

Setting emulator port for Firestore and Database not working #634

Description

@eljass

Version

@nuxtjs/firebase: 8.2.2
firebase: 9.9.2
nuxt: 2.15.7

Reproduction Link

Steps to reproduce

// nuxt.config.js
const { NODE_ENV, FIRE_EMULATOR } = process.env
const isDev = NODE_ENV === 'development'
const isEmulator = FIRE_EMULATOR === 'true'

export default {
...
  firebase: {
    ...,
    services: {
      auth: {
          persistence: 'local',
          initialize: {
            onAuthStateChangedMutation: null,
            onAuthStateChangedAction: 'auth/ON_AUTH_CHANGED',
            subscribeManually: true,
          },
          ssr: {
            ignorePaths: ['/api'],
          },
          emulatorPort: isDev && isEmulator ? 9099 : null,
      },
      firestore: {
        memoryOnly: false,
        emulatorPort: isDev && isEmulator ? 8080 : null,
      },
      functions: false,
      storage: true,
      database: {
        emulatorPort: isDev && isEmulator ? 9000 : null,
      },
      performance: false,
      analytics: false,
      remoteConfig: false,
      messaging: false,
      terminateDatabasesAfterGenerate: true,
    }
  },
  ...
}

What is Expected?

It should be possible to set the port for each service seperately.

What is actually happening?

Setting emulator port in both configurations, firestore and database results FIREBASE FATAL ERROR: Cannot call useEmulator() after instance has already been initialized. on SSR.

This can be fixed by removing the emulatorPort field from database, and it will use an emulator, but according to docs, this should not be the case.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions