簡體   English   中英

為什么我會收到FirebaseAppService的斷言錯誤

[英]Why am i getting assertion error of FirebaseAppService

版本信息

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

重現步驟嘗試將記錄保存在控制器的Firebase存儲中:

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)
    }
  }
});

Firebase在環境中的配置:

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

預期行為成功保存數據

調用記錄的保存方法后的實際行為我遇到了一個錯誤:

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)

我如何嘗試解決它:

  • 安裝了不同版本的emberfire和ember-cli,但是還有另一個問題
  • 在Google和github問題中搜索到錯誤,但沒有任何結果

昨天我也發生了同樣的事情(您的問題是6個小時大了)。 由於您的余燼數據為3.11,因此我將假設您的余燼源也為3.11。

通過從3.11.1更改"ember-source" "~3.10"來修復此問題

然后,我刪除了node_modules目錄,然后再次運行npm install

我的GUESS警告是因為3.11中添加了新內容

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM