为什么我会收到 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 小时了)。由于您的 ember 数据是 3.11,我假设您的 ember-source 也是 3.11.
通过从 3.11.1
更改 "ember-source" "~3.10"
来修复它
然后我又删除了我的node_modules目录和运行npm install
。
我的猜测是警告是因为 3.11 中添加了一些新内容
版本信息
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 小时了)。由于您的 ember 数据是 3.11,我假设您的 ember-source 也是 3.11.
通过从 3.11.1
更改"ember-source" "~3.10"
来修复它
然后我又删除了我的node_modules目录和运行npm install
。
我的猜测是警告是因为 3.11 中添加了一些新内容