简体   繁体   English

FIREBASE警告:TypeError:无法读取未定义的属性“ then”

[英]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.

相关问题 Firebase TypeError:无法读取未定义的属性“ ac” - Firebase TypeError: Cannot read property 'ac' of undefined Firebase TypeError:无法读取未定义的属性“val” - Firebase TypeError: Cannot read property 'val' of undefined 类型错误:无法读取未定义的属性“长度”- Firebase - TypeError: Cannot read property 'length' of undefined - Firebase TypeError:无法读取未定义的firebase和vuex的属性“ 0” - TypeError: Cannot read property '0' of undefined firebase and vuex 获取Vue警告TypeError:无法读取未定义的属性,但存在数据 - Getting a Vue warning TypeError: Cannot read property of undefined but the data is present ReactJS。 Firebase。 TypeError:无法读取未定义的属性“setState” - ReactJS. Firebase. TypeError: Cannot read property 'setState' of undefined 用 FIREBASE 表达我得到 TypeError: Cannot read property 'trim' of undefined - Express with FIREBASE I get TypeError: Cannot read property 'trim' of undefined Firebase未捕获的TypeError:无法读取未定义的属性'forEach' - Firebase Uncaught TypeError: Cannot read property 'forEach' of undefined firebase onAuth()抛出:TypeError无法读取未定义的属性'auth' - firebase onAuth() throwing: TypeError cannot read property 'auth' of undefined 类型错误:无法使用 firebase 读取未定义错误的属性“名称” - TypeError: Cannot read property 'name' of undefined error using firebase
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM