FirebaseExtended / polymerfire

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

duplicate app name #184

Open sowsan opened 7 years ago

sowsan commented 7 years ago

Hello -

I'm getting the duplicate app name error while loading the firebase-app element, its throwing the below if I didnt specify the project name, if I specify it will show same error message with its name. Any help much appreciated !

"FirebaseError: Firebase: Firebase App named '[DEFAULT]' already exists (app/duplicate-app). at Z (http://localhost:5000/bower_components/firebase/firebase-app.js:33:395) at Object.initializeApp (http://localhost:5000/bower_components/firebase/firebase-app.js:32:29) at HTMLElement.__computeApp (http://localhost:5000/bower_components/polymerfire/firebase-app.html:117:36) at HTMLElement._computeEffect (http://localhost:5000/bower_components/polymer/polymer.html:1684:24) at HTMLElement._effectEffects (http://localhost:5000/bower_components/polymer/polymer.html:1507:7) at HTMLElement._propertySetter (http://localhost:5000/bower_components/polymer/polymer.html:1491:6) at HTMLElement.__setProperty (http://localhost:5000/bower_components/polymer/polymer.html:1500:6) at HTMLElement._applyConfig (http://localhost:5000/bower_components/polymer/polymer.html:2111:6) at HTMLElement._afterClientsReady (http://localhost:5000/bower_components/polymer/polymer.html:2105:6) at HTMLElement._ready (http://localhost:5000/bower_components/polymer/polymer-mini.html:70:6)"

khammami commented 7 years ago

@sowsan you're using firebase-app more than one time in your code, if you're using different firebase projects in your app you need to set a name for each firebase-app element otherwise it will use 'default' as name. if you're using only one firebase project for your app you should define firebase-app element only once.

bobtista commented 7 years ago

I have the same issue, but my app is a simple one-page app. This error also happens if you leave out or misspell an import. It also seems to happen if the name starts with "main" as in "main-page" or "main-view" for polymer elements. Not sure why, but I was able to take the exact same file, and rename it to "view-main" and it started working.

I'm happy to link to my repo if anyone can help me figure out why it happens with that name. Also, can we fix the error so it's not so useless and irrelevant? Something like "file used but not imported" or "imported filename not found"

jifalops commented 7 years ago

I get this error when setting the properties of firebase-app through Javascript. The solution was to not include the element until all of the properties were defined.

<template is="dom-if" if="[[readyToConnectApp]]">
  <firebase-app ...>
...
ready: function() {
  // set properties
  this.readyToConnectApp = true;
}

Note that in Polymer 2.0 you should be able to use this._setProperties({}); instead.