CollectionReference.doc() requires its first argument to be of type non-empty string

徘徊边缘 提交于 2020-03-03 12:08:49

问题


I have an ionic app trying to update the records in firebase. I keep on getting this error. Not sure what I am doing wrong.

Error: Uncaught (in promise): FirebaseError: [code=invalid-argument]: Function CollectionReference.doc() requires its first argument to be of type non-empty string, but it was: a custom Object object

FirebaseError: Function CollectionReference.doc() requires its first argument to be of type non-empty string, but it was: a custom Object object

this is my update function.

updateTodo(todo: Todo, id: string) {

    return this.todosCollection.doc(id).update(todo)
}

回答1:


This happens when you are trying to send an empty object to firebase. I had this error when I reset my form values before the async call could finish..



来源:https://stackoverflow.com/questions/57503465/collectionreference-doc-requires-its-first-argument-to-be-of-type-non-empty-st

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!