如何使用AWS Lambda nodejs将数据推送/设置到firebase中?

时间:2017-10-31 07:51:18

标签: node.js amazon-web-services lambda

我对aws lambda很新,我不确定如何使用它将数据设置到firebase中。以下是我目前的代码:

var firebase = require("firebase");

exports.handler = (event, context, callback) => {
context.callbackWaitsForEmptyEventLoop = false;  

var config = {
    apiKey: "cannot be shown",
    authDomain: "cannot be shown",
    databaseURL: "cannot be shown",
    projectId: "cannot be shown",
    storageBucket: "cannot be shown",
    messagingSenderId: "cannot be shown"
};

if(firebase.apps.length === 0) {   
    firebase.initializeApp(config);
}

exports.handler = (event, context, callback) => {
    firebase.database().ref('/').set({
    username: "test",
    email: "test@mail.com"
    });

    callback(null, 'Hello from Lambda'); 
};

};

由此,我怎么能这样做或者我的代码做错了?

0 个答案:

没有答案