$fireMess undefined in production mode
See original GitHub issueVersion
@nuxtjs/firebase: ^5.0.7 firebase: ^7.14.2 nuxt: 2.11.0
Reproduction Link
https://firebase.nuxtjs.org/guide/usage/#general-usage
Steps to reproduce
- Setup Nuxt JS project and install Firebase and the Firebase Module, set to universal mode.
- Setup config of module with the following services object:
services: {
messaging: true
}
- The following code is added for token refresh:
var messaging = this.$fireMess;
messaging.onTokenRefresh(() => {
...
});
What is Expected?
this.$fireMess
should be defined in production Nuxt JS.
What is actually happening?
this.$fireMess
is undefined in production mode of Nuxt JS.
Issue Analytics
- State:
- Created 3 years ago
- Comments:6 (3 by maintainers)
Top Results From Across the Web
Webpack production mode - NODE_ENV undefined
Way I found is to use argv.mode variable inside export like so: module.exports = (env, argv) => { const isDevelopment = argv.mode !==...
Read more >Production Mode : ERROR TypeError: Cannot read property of ...
I m trying to use Schedule in my Angular App. In Developpment mode every thinks works perfectly. But in Production mode, I'm able...
Read more >3/1/11 - Ron Martinsen's Photography Blog
To turn my print into a scanned image, I started by using EPSON Scan in Professional Mode using values I thought an average...
Read more >My script is working on development mode but not o...
Hello, I have added my custom script in footer That script is working on development mode, but not on production mode it gives...
Read more >Vue 3 production mode makes `this` undefined - Get Help
For this code: https://codesandbox.io/s/crazy-worker-kkq1c (once deployed: https://csb-kkq1c.netlify.app/) I can see that var t = this; ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
You’re right, but it runs nuxt in production mode, which is what you named as the issue, so I used it to quickly check if it’s just that.
If you read my message you see that after that I did nuxt generate and deployed the static html, and did not run into the issue. So a productive generate deployment works, too.
So that way I could assume it’s something related to your setup.
In any case, the information that you run into troubles running it with MAMP Pro is valuable. So I installed MMAP Pro, set up a host, ran it, and: Got same issue as you. Finally =)
Now MAMP Pro doesn’t run any SSL just like that, which is needed for Firebase Messaging to work.
So I did:
Restarted the server and it worked.
Let me know if that does anything for you.
@sts-ryan-holton
So I just did the following:
nuxt build
and thennuxt start
And it wasn’t undefined in production mode:
So to see if a generated & deployed Nuxt generate behaves the same way, I deployed a static site to Firebase:
https://nuxt-fire-demo.web.app/ Also works…
So there must be something off with your config, or your environment (e.g. your browser) where you test it. Know that messaging is not supported on all browsers, so it doesn’t get initialized if the browser doens’t support it.
Though I assume you tested it on the same browser in dev and prod so that’s probably not it either…
Btw here is the branch of the demo on which I tested it out, maybe the code there helps you to find the issue.