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

Messaging undefined #637

Open
93lucasp opened this issue Dec 19, 2022 · 1 comment
Open

Messaging undefined #637

93lucasp opened this issue Dec 19, 2022 · 1 comment

Comments

@93lucasp
Copy link

93lucasp commented Dec 19, 2022

Version

@nuxtjs/firebase: 8.2.2
firebase: 9.15.0
nuxt: 2.15.8

What is actually happening?

In the mounted $fire.messaging is undefined.

this is my configuration:

modules: [
    // https://go.nuxtjs.dev/axios
    '@nuxtjs/axios',
    '@nuxtjs/auth-next',
    [
      '@nuxtjs/firebase',
      {
        config: {
          apiKey: "...",
          authDomain: "...",
          projectId: "...",
          storageBucket: "...",
          messagingSenderId: "...",
          appId: "...",
          measurementId: "..."
        },
        
        services: {
          messaging: {
            createServiceWorker: true,
            fcmPublicVapidKey: '...', 
            inject: fs.readFileSync('./serviceWorker.js') 
          },
        }
      }]
  ],

and this is the code inside the mounted:

 if (process.client) {
    console.log(this.$fire)
}

but it is undefined
Schermata 2022-12-19 alle 17 24 27

@Bishanta
Copy link

I resolved the issue, after removing server property at the end of nuxt.config.js. FCM didn't work when my project wasn't running on localhost.

...other configs above

// Build Configuration: https://go.nuxtjs.dev/config-build
build: {
vendor: ['vue-i18n'],
},
server: { //remove this server property entirely.
host: "0.0.0.0"
}
}

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

2 participants