简体   繁体   中英

Why am i getting assertion error of FirebaseAppService

Version info

DEBUG: -------------------------------
DEBUG: Ember      :  3.4.4
DEBUG: Ember Data : 3.11.0
DEBUG: EmberFire  : 3.0.0-rc.3
DEBUG: -------------------------------

Steps to reproduce Try to save record on my firebase storage in controller:

import Controller from '@ember/controller';
import { computed } from '@ember/object';
import v4 from 'npm:uuid/v4'

export default Controller.extend({
  emailFromValue: '',
  header: 'Coming soon',
  alertMessage: '',
  showAlert: false,
  isDisabled: computed('emailFromValue', function() {
    return !this.emailFromValue.match(/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/);
  }),
  actions: {
    changeEmailValue({ target: { value } }) {
      this.set('emailFromValue', value);
    },
    requestInvitation(e){
      e.preventDefault();
      this.store.createRecord('invitation', { id:v4(), email: this.emailFromValue}).save()

      this.set('alertMessage',`Thank you! We saved your email address: ${this.emailFromValue}`)
      this.set('showAlert', true)
    }
  }
});

config of firebase in environment:

firebase: {
      apiKey: "AIzaSyAhO6f8wKS-...",
      authDomain: "...9e.firebaseapp.com",
      databaseURL: "...39e.firebaseio.com",
      projectId: "...39e",
      storageBucket: "",
      messagingSenderId: "...45128",
      appId: "...94d4964176"
    },

Expected behavior Successful save the data

Actual behavior after calling save method of record i've got an error:

index.js:163 Uncaught Error: Assertion Failed: You must call `this._super(...arguments);` when overriding `init` on a framework object. Please update <libraries-app@service:firebase-app::ember204> to call `this._super(...arguments);` from `init`.
    at assert (index.js:163)
    at FirebaseAppService.__ASSERT_INIT_WAS_CALLED__ember1565768194366642062813808__ (object.js:88)
    at sendEvent (metal.js:462)
    at initialize (core_object.js:107)
    at Function.create (core_object.js:692)
    at FactoryManager.create (container.js:549)
    at instantiateFactory (container.js:359)
    at lookup (container.js:287)
    at Container.lookup (container.js:131)
    at Class.lookup (container_proxy.js:78)

How have i already tried to solve it:

  • Installed different versions of emberfire and ember-cli, but had another issues
  • Searched error in google and github issues, but haven't got any result

Same thing happened to me yesterday (your question was 6 hours old). Since your ember data is 3.11 im going to assume that your ember-source is also 3.11.

Fixed it by changing "ember-source" "~3.10" from 3.11.1

Then I deleted my node_modules directory and ran npm install again.

My GUESS is the warning is because something new was added in 3.11

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM