I am using the Firebase node.js admin sdk to create user accounts via a csv importer with custom uids. This all works fine. On succesfull creation of the account I would like to update a database reference. However whenever the function loops through to create the entries in the db it fails with the message
Uncaught Error: Firebase.child failed: First argument was an invalid path: "contractors/jk116734s". Paths must be non-empty strings and can't contain ".", "#", "$", "[", or "]"
as you can see in the logged message above the path doesn't contain any of those unwanted characters and the path is not empty. Strangely it does update one record in the db but all the others fail. The path "contractors/jk116734s" I am also logging all the paths and none are undefined or containing invalid characters. The jk***** part of the urls are all unique fyi.
Here is my function that gets called on each succesfull account creation.
function createDbEtnryForUser(index, contractorData) {
var ni = contractorData.ni;
var path = "contractors/" + ni
console.log(path);
databaseRoot.ref(path).update(contractorData);
databaseRoot.ref(path).once('value',function(snapshot) {
$('#row-'+index).css({"background-color":"green", "color":"white"});
});
}
also you can see one entry is getting created but the rest are not.
Weirdly if I don't use the custom uid and use the auto uids created by firebase all works fine. What I don't understand though is that all the accounts do get created with the custom uid and as you can see logged I am getting the custom uid back to use in the call to update.