Using Firebase API in Lambda Functions AWS
<p>Can someone please tell me how to do this? </p>

<p>This is what i have so far and It's not adding data into my database</p>

<p>I tested this out without using lambda functions on a regular web application and it works</p>

<pre><code>var http = require('http');
var firebase = require('firebase');

exports.handler = (event, context, callback) =&gt; {

        var config = {
            apiKey: "AIzaSyCpk23423Iy_akmUniqUJhLt234324YPBE1vD7At8Laj4",
            authDomain: "echoproject-blah.firebaseapp.com",
            databaseURL: "https://echoproject-blah.firebaseio.com",
            storageBucket: "echoproject-blah.appspot.com",
            messagingSenderId: "83962234234322"
        };


   firebase.initializeApp(config);

   firebase.datetbase().ref('/employee/').push({
      med_number: Math.floor(Math.random() * 1000),
      full_name: 'John Smith',
      date_employed: Date.now(),
      email: '23432432@yahoo.com',
      phone_number: '+123423423',
      profile_picture : 'blah.img'
   }).catch(function(err){
    console.log(err);
   });



    if (event.session.new) {
        onSessionStarted({ requestId: event.request.requestId }, event.session);
    }

    if (event.request.type === 'LaunchRequest') {
        onLaunch(event.request,
            event.session,
            (sessionAttributes, speechletResponse) =&gt; {
                callback(null, buildResponse(sessionAttributes, speechletResponse));
            });
    } else if (event.request.type === 'IntentRequest') {
        onIntent(event.request,
            event.session,
            (sessionAttributes, speechletResponse) =&gt; {
                callback(null, buildResponse(sessionAttributes, speechletResponse));
            });
    } else if (event.request.type === 'SessionEndedRequest') {
        onSessionEnded(event.request, event.session);
        callback();
    }
   } catch (err) {
    callback(err);
     }



}
</code></pre>

<p>I'm I missing something? </p>

<p>I'm trying to use firebase for my Amazon Echo. Would that be troubling it?</p>

<p>Is my firebase.database not getting recognize?</p>

<p><strong>UPDATE</strong></p>

<p>None of these <a href="https://stackoverflow.com/questions/37325775/amazon-lambda-to-firebase">solutions</a> worked for me either</p>

<h1>**SOLVED**</h1>

<p>So after much frustration I decided to ditch the firebase Nodejs sdk and use the Firebase Endpoint urls</p>

<pre><code>var myJSONObject = {
            med_number: Math.floor(Math.random() * 1000),
            full_name: 'John Bruh',
            date_employed: Date.now(),
            email: 'vi43544tle@yahoo.com',
            phone_number: '+345345',
            profile_picture : '34534534'
        };
request({
    url: "https://echoproject-c78fghfgh6f.firebaseio.com/rest/saving-data/users.json",
    method: "POST",
    json: true,   // &lt;--Very important!!!
    body: myJSONObject
}, function (error, response, body){
    if(error) console.log(error);
    console.log(response);
});
</code></pre>