title: I cannot push data using .push() function with firebase using node.js
body: <p>We are creating a firebase web app with nodejs and we wanted to upload a form with a bunch of information but the only thing that is getting uploaded is the image in the firebase storage but the other data does not show up in the firebase realtime database. Here is the block of code which is inside of an onclick event listener of a button, but the main problem is the line with var newPostRef  =  databaseRef.push();. Any help or suggestion of any kind will be much appreciated. Help me please.</p>
  <pre><code>
  var databaseRef = firebase.database().ref().child(&quot;Items&quot;);
  //Upload and save image to firebase storage
  databaseRef.once(&quot;value&quot;).then(function(snapshot){
  var name = picture[&quot;name&quot;];
  var dateStr = new Date().getTime();  
  var fileCompleteName = name + &quot;_&quot; + dateStr;
  var storageRef = firebase.storage().ref(&quot;Items Images&quot;);
  var itemStorageRef = storageRef.child(fileCompleteName);
  var upload = itemStorageRef.put(picture);
  upload.on(&quot;state_changed&quot;,
  function error(err){
  
            },
  function complete(){
  var user = firebase.auth().currentUser;
  var userName;
  
  firebase.database().ref('Users/' + user.uid).once('value').then(function(snapshot){
  var fName = (snapshot.val() &amp;&amp; snapshot.val().firstName);
  var lName = (snapshot.val() &amp;&amp; snapshot.val().lastName); 
  userName = fName + &quot; &quot; + lName;   
              });
  upload.snapshot.ref.getDownloadURL().then(function(downloadURL){
  var time = new Date();
  
  var options = {
  weekday: &quot;long&quot;,
  month: &quot;long&quot;,
  day: &quot;2-digit&quot;,
  year: &quot;numeric&quot;,
                };
  var itemData = {
  &quot;uid&quot;: user.uid,
  &quot;name&quot;: fileCompleteName, 
  &quot;itemName&quot;: iname,
  &quot;itemCategory&quot;: icategory,
  &quot;venueLast&quot;: ivenue,
  &quot;dateLast&quot;: idate,
  &quot;timeLast&quot;: itime,
  &quot;itemBrand&quot;: ibrand,
  &quot;itemColor&quot;: icolor,
  &quot;itemMaterial&quot;: imaterial,
  &quot;itemQty&quot;: iqty,
  &quot;repo&quot;: irepo,
  &quot;name&quot;: userName,
  &quot;image&quot;: downloadURL,
  &quot;time&quot;: time.toLocaleString('en-US', {hour: 'numeric', minute: 'numeric', hour12: true}),
  &quot;date&quot;: time.toLocaleDateString('en-US', options),
  
                };
  
  var newPostRef = databaseRef.push();
  newPostRef.set(itemData, function(err){
  if(err){
  $(&quot;#result&quot;).attr(&quot;class&quot;, &quot;alert alert-danger&quot;);
  $(&quot;#result&quot;).html(err.message);
                  }
  else{
  $(&quot;#result&quot;).attr(&quot;class&quot;, &quot;alert alert-success&quot;);
  $(&quot;#result&quot;).html(&quot;post has been uploaded successfully.&quot;);
  window.open(&quot;&quot;, &quot;_self&quot;);
                  }
                });
              });
            }
        );
        });
  </code></pre>