title: Firebase function .onWrite not working?
body: <p>Ok, I have looked at similar questions like <a href="https://stackoverflow.com/questions/46773794/firebase-function-onwrite-not-being-called">Firebase function onWrite not being called</a> and thought it was my fault getting the reference, but I have no idea what is happening here with my Firebase functions. </p>
  
  <p>I am just trying to get a function to write to my database when a write has been made to database. I followed the firebase tutorial exactly:</p>
  
  <pre><code>const functions = require('firebase-functions');
  
  // The Firebase Admin SDK to access the Firebase Realtime Database.
  //https://firebase.google.com/docs/functions/database-events
  
  const admin = require('firebase-admin');
  admin.initializeApp(functions.config().firebase);
  
  // const gl = require('getlocation');
  
  exports.helloWorld = functions.https.onRequest((request, response) =&gt; {
   response.send("Hello from Firebase!");
  });
  
  exports.enterLocation = functions.database.ref('/Users/{name}') //brackets is client param
      .onWrite(event =&gt; {
        // Grab the current value of what was written to the Realtime Database.
        // const original = event.data.val();
        console.log('SKYLAR HERE:', event.params.name);
        // You must return a Promise when performing asynchronous tasks inside a Functions such as
  
        return firebase.database().ref('/Users/{name}').set({ location: 'test loc' });
    });
  </code></pre>
  
  <p>The function is being run, yet in my logs I get a pretty unhelpful error that it is getting the {name} param, and data is definitely written to my database, however my SERVER code is not writing:</p>
  
  <p><a href="https://i.stack.imgur.com/eP4WF.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/eP4WF.png" alt="enter image description here"></a></p>
  
  <p>I get - </p>
  
  <blockquote>
    <p>ReferenceError: firebase is not defined at
    exports.enterLocation.functions.database.ref</p>
  </blockquote>
  
  <p>Which makes no sense as it is defined. I just want to add an extra child under the user I create, like I do already with "password"</p>
  
  <p><a href="https://i.stack.imgur.com/vWAVC.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/vWAVC.png" alt="enter image description here"></a></p>
  
  <p>What am I doing wrong?</p>