我对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');
};
};
由此,我怎么能这样做或者我的代码做错了?