[英]FIREBASE WARNING: TypeError: Cannot read property 'then' of undefined
According to the documentation, most of the firebase-database verbs return promises. 根据文档,大多数firebase-database动词都返回promise。 Yet I cannot call
.then()
on .once()
or .remove()
or .set()
然而,我不能打电话
.then()
上.once()
或.remove()
或.set()
This is the version I am using: 这是我使用的版本:
4.12.0 4.12.0
Here is the error 这是错误
FIREBASE WARNING: Exception was thrown by user callback. TypeError: Cannot read property 'then' of undefined
Here is the specific example: 这是具体示例:
collab_ref = new Firebase(FBURL + 'collaboration_songs').child(collaboration_id);
return collab_ref.remove().then(function(){
return cb();
});
According to the docs the right way for initialize a firebase app, from 3.x and higher, is this way. 根据文档,从3.x及更高版本初始化Firebase应用程序的正确方法是这种方式。
Init 在里面
var config = {
apiKey: "apiKey",
authDomain: "projectId.firebaseapp.com",
databaseURL: "https://databaseName.firebaseio.com"
};
firebase.initializeApp(config);
And have fun 玩得开心
var niceNode = firebase.database().ref().child('collaboration_songs')
.remove()
.then(resolve => { return ':)'}, (reject) => return ':(');
https://firebase.google.com/docs/database/web/start https://firebase.google.com/docs/database/web/start
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.