Problem with Emberfire

I made a test app in Ember 3.0 based on a book and I used Emberfire as the database. I have now a new version of the book based on Ember 3.10 and wanted to do it again from scratch. I have now installed Ember 3.12 and instead of storing data internally in the app I wanted to reuse my Emberfire database. I have installed Emberfire@next but for some reason I do not get access to my data.

This is the adapter:


import FirestoreAdapter from 'emberfire/adapters/firestore';

export default FirestoreAdapter.extend({

  // Uncomment the following lines to enable offline persistence and multi-tab support
  //enablePersistence: true,
  //persistenceSettings: { synchronizeTabs: true }
});

Here is a model:


import DS from 'ember-data';
const { Model, attr, hasMany } = DS;

export default Model.extend({
  name: attr('string'),
  description: attr('string'),
  songs: hasMany('song'),

});

Here is the route:


import Route from '@ember/routing/route';

export default Route.extend({
  model() {
    return this.store.findAll('band');
  },

});

And a template:


<ul>
  {{#each model as |band|}}
    <li>{{band.name}} {{band.description}}</li>
  {{/each}}
</ul>

This is what is installed:


DEBUG: -------------------------------
vendor.js:48590 DEBUG: Ember      : 3.12.0
vendor.js:48590 DEBUG: Ember Data : 3.12.0
vendor.js:48590 DEBUG: jQuery     : 3.4.1
vendor.js:48590 DEBUG: EmberFire  : 3.0.0-rc.3
vendor.js:48590 DEBUG: Firebase   : 6.3.5

This is the error I get:


Error while processing route: bands Assertion Failed: You must call `this._super(...arguments);` when overriding `init` on a framework object. Please update <rarwe311@service:firebase-app::ember247> to call `this._super(...arguments);` from `init`. Error: Assertion Failed: You must call `this._super(...arguments);` when overriding `init` on a framework object. Please update <rarwe311@service:firebase-app::ember247> to call `this._super(...arguments);` from `init`.
    at assert (http://localhost:4311/assets/vendor.js:48568:17)
    at FirebaseAppService.__ASSERT_INIT_WAS_CALLED__ember1566481749836931747236082__ (http://localhost:4311/assets/vendor.js:42765:63)
    at sendEvent (http://localhost:4311/assets/vendor.js:25445:14)
    at initialize (http://localhost:4311/assets/vendor.js:41695:26)
    at Function.create (http://localhost:4311/assets/vendor.js:42280:9)
    at FactoryManager.create (http://localhost:4311/assets/vendor.js:11800:33)
    at instantiateFactory (http://localhost:4311/assets/vendor.js:11610:63)
    at lookup (http://localhost:4311/assets/vendor.js:11538:12)
    at Container.lookup (http://localhost:4311/assets/vendor.js:11382:14)
    at Class.lookup (http://localhost:4311/assets/vendor.js:39970:33)

Uncaught Error: Assertion Failed: You must call `this._super(...arguments);` when overriding `init` on a framework object. Please update <rarwe311@service:firebase-app::ember247> to call `this._super(...arguments);` from `init`.
    at assert (vendor.js:48568)
    at FirebaseAppService.__ASSERT_INIT_WAS_CALLED__ember1566481749836931747236082__ (vendor.js:42765)
    at sendEvent (vendor.js:25445)
    at initialize (vendor.js:41695)
    at Function.create (vendor.js:42280)
    at FactoryManager.create (vendor.js:11800)
    at instantiateFactory (vendor.js:11610)
    at lookup (vendor.js:11538)
    at Container.lookup (vendor.js:11382)
    at Class.lookup (vendor.js:39970)
assert @ vendor.js:48568
__ASSERT_INIT_WAS_CALLED__ember1566481749836931747236082__ @ vendor.js:42765
sendEvent @ vendor.js:25445

Maybe someone could point me in the right direction, thanks

Sounds like they need to change the EmberFire firebase-app service to be compatible with Ember 3.11/3.12. This issue suggests that you could downgrade your ember-source package to 3.10 and it should work

Looks like there is also an open PR so hopefully it gets merged soon

I have tried several things, also downgrading also to 3.10 as I read it somewhere, but it didn’t seem to work. As I remember I got rid of the error message but then nothing at all happened in my app. I then upgraded to 3.12 in the hope that it would work. Thank you for your answer.

Are you pointing at the right database? emberfire v2 is an adapter for firebase realtime databases where as emberfire@next (v3) is for firebase firestore databases and rtdbs (above you are using the firestore adapter). Given you said you wanted to reuse your existing database I’m just wondering if this something you have imported into firestore?

Interesting point. So, when I downgraded to ember-source 3.10 and saw nothing in my app it could be because I was accessing an empty database. I will have a closer look, thank you.

Back to 3.10 and it turned out that I was accessing an empty database. Also the Firestore is NoSql which is a complete new world to an old mainframe developer. I have manually put a bit of data into the Firestore base and it shows in my app.

If you use the master branch, then you need to fiddle around with some stuff, as they are still working on it. Here ist a list I found:

The second blocker says you have to edit a file in your node_modules folder manually. That means if you do that, your changes could be overwritten with any “ember/npm/yarn install”.

It worked for me and looks like this now:

“my-ember-app/node_modules/emberfire/addon/services/firebase-app.js”

Hi Gerrit, This looks interesting, I’ll try it tomorrow.

1 Like

If you have additional issues to get started, just give me a shout. I just put up an app with authentication and CRUD operations last week.

I did the hack and it works with fine 3.12, only one small change to one line. You mention an app, where can I have a peek on that?

Hello, show your hack please) I need it too

In the file “my-ember-app/node_modules/emberfire/addon/services/firebase-app.js” you comment out the line as shown here and add the second line instead

        //this._super(...arguments);
        super.init( ...arguments);

and please remember to do it again if you do a npm install

thank you now it’s working! I knew about this hack but after this correction I have same problem in another component and I did not immediately see that this is another problem)

you can inherit the firebase-app service and not fix it every time after npm install