Error: Firebase.child failed: First argument was an invalid path: “null”. Paths must be non-empty strings and can't contain “.”, “#”, “$”, “[”, or “]”


#1

am making one chat application in which … while adding member in group am getting this error

Error: Reference.child failed: First argument was an invalid path = “undefined”. Paths must be non-empty strings and can’t contain “.”, “#”, “$”, “[”, or “]”
at Object.exports.validatePathString (http://localhost:8100/build/vendor.js:39083:15)
at Reference.child (http://localhost:8100/build/vendor.js:63197:30)
at GroupsProvider.webpackJsonp.286.GroupsProvider.addmember (http://localhost:8100/build/main.js:493:103)
at GroupbuddiesPage.webpackJsonp.485.GroupbuddiesPage.addbuddy (http://localhost:8100/build/9.js:110:27)
at Object.eval [as handleEvent] (ng:///GroupbuddiesPageModule/GroupbuddiesPage.ngfactory.js:35:31)
at handleEvent (http://localhost:8100/build/vendor.js:13921:155)
at callWithDebugContext (http://localhost:8100/build/vendor.js:15430:42)
at Object.debugHandleEvent [as handleEvent] (http://localhost:8100/build/vendor.js:15017:12)
at dispatchEvent (http://localhost:8100/build/vendor.js:10336:25)
at http://localhost:8100/build/vendor.js:10961:38

please check my below code

getgroupimage() {
return new Promise((resolve, reject) => {
this.firegroup.child(firebase.auth().currentUser.uid).child(this.currentgroupname).once(‘value’, (snapshot) => {
this.grouppic = snapshot.val().groupimage;
resolve(true);
})
})

}
addmember(newmember) {
this.firegroup.child(firebase.auth().currentUser.uid).child(this.currentgroupname).child(‘members’).push(newmember).then(() => {
this.getgroupimage().then(() => {
this.firegroup.child(newmember.uid).child(this.currentgroupname).set({
groupimage: this.grouppic,
owner: firebase.auth().currentUser.uid,
msgboard: ‘’
}).catch((err) => {
console.log(err);
})
})
this.getintogroup(this.currentgroupname);
})
}
}

my addbuddy function

addbuddy(buddy) {
this.newbuddy = buddy;
this.groupservice.addmember(buddy);
}

my html code -

Group Buddies

{{key.displayName}}

Add

please help me to fix this error


#2

my .html file code


#3

Please edit your post, it is not very readable at the moment.
Use the </> button above the input field to format your code, command line output or error message (select the text first, then click the button or wrap it in ``` manually). Check the preview if it looks better. This will make sure your text is readable and if it recognizes the programming language it also automatically adds code syntax highlighting. Thanks.


#4

i am also having this problem but my problem is the form is does not sent any data into the firebase database.i am currently make a sign up account with more detail such as email,password and etc data.the registration is success but the other data is not write into the database.could you help me