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

Setting emulator port for Firestore and Database not working #634

Open
eljass opened this issue Sep 26, 2022 · 0 comments
Open

Setting emulator port for Firestore and Database not working #634

eljass opened this issue Sep 26, 2022 · 0 comments

Comments

@eljass
Copy link
Contributor

eljass commented Sep 26, 2022

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant