FirebaseExtended / polymerfire

Polymer Web Components for Firebase
https://www.webcomponents.org/element/firebase/polymerfire
MIT License
459 stars 142 forks source link

Error "firebase-messaging: No app configured" #220

Closed esd100 closed 7 years ago

esd100 commented 7 years ago

Description

I set up the firebase messaging app, exactly how was performed in Polycast https://youtu.be/AAZyQ4Ymkpc and according to the readme file on https://www.webcomponents.org/element/firebase/polymerfire/elements/firebase-messaging.

Expected outcome

Able to get firebase messaging to work or dialog box to allow notifications.

I'm not sure why it says no app is configured! I definitely have an app configured and I'm using it with other polymerfire elements just fine. Firebase-auth works. Firebase-query works. Firebase-app works. Firebase-document sort of works but that's a different issue.

Actual outcome

Console ==> Uncaught Error: firebase-messaging: No app configured!

This error is thrown by firebase-messaging.html https://github.com/firebase/polymerfire/blob/master/firebase-messaging.html line#219

        /**
         * Requests Notifications permission and returns a `Promise` that
         * resolves if it is granted. Resolves immediately if already granted.
         */
        requestPermission: function() {
          if (!this.messaging) {
            throw new Error('firebase-messaging: No app configured!');
          }
          return this.messaging.requestPermission().then(function() {
            return refreshToken(this.app);
          }.bind(this));
        },

This is a somewhat cryptic error message and should be updated, which is a separate enhancement issue. What does this mean? I have an app configured but it's telling me that I don't!

esd100 commented 7 years ago

Is anyone working on polymerfire?

mbleigh commented 7 years ago

Yes, though it's no one's full time job. Also Google I/O is an extremely busy time for many of us who maintain these kinds of projects :)

On Wed, May 17, 2017, 10:08 PM esd100 notifications@github.com wrote:

Is anyone working on polymerfire?

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/firebase/polymerfire/issues/220#issuecomment-302301902, or mute the thread https://github.com/notifications/unsubscribe-auth/AAAD_gTOxJXN6zs-IZbCNXNtwTEC8V0Sks5r69JpgaJpZM4NcMXa .

esd100 commented 7 years ago

I didn't mean to be rude. I'm sorry if it came across that way. Do you think that you could help me with this issue Michael, since you seem to be the expert? I would really appreciate it.

govis commented 7 years ago

Make sure that your firebase-app element has loaded (missing an import can render a polymer element incapable), you can poke at it in dev tools. Coming up with a repro of your problem is a good start as well.

esd100 commented 7 years ago

@govis thanks for your insights.

I'm not sure why the firebase-app wouldn't be loaded. All of the other polymerfire elements have been working fine.

As for repro, I'm afraid I just don't have the knowledge of how to do that. I'm happy to share my repo with one of you google firebase polymer experts, if that can help.

esd100 commented 7 years ago

@mbleigh since you are an expert do you mind commenting on the specific error message. It is not very self explanatory, which is why I'm on here.

esd100 commented 7 years ago

Is anyone willing to take some time to help me with this?

esd100 commented 7 years ago

Argh! I made a stupid mistake! Sorry for being a nuisance.

I forgot about the attribute to property camelCase mapping.

I had the attribute written as appName instead of app-name.

Issue can be closed, as this fixed the problem.