I get \'Cannot find module \'firebase\' when I try to run this in Lambda (Node.js 4.3)
var Firebase = require(\'firebase\');
Same thing hap
To safely use firebase npm package (version 3.3.0) in AWS Lambda (Nodejs 4.3), Please do the following:
'use strict';
var firebase = require("firebase");
exports.handler = (event, context, callback) => {
context.callbackWaitsForEmptyEventLoop = false; //<---Important
var config = {
apiKey: "<>",
authDomain: "<>.firebaseapp.com",
databaseURL: "https://<>.firebaseio.com",
storageBucket: "<>.appspot.com",
};
if(firebase.apps.length == 0) { // <---Important!!! In lambda, it will cause double initialization.
firebase.initializeApp(config);
}
...
...
};