I keep getting error
error Each then() should return a value or throw
I'm not sure how to fix it. I'm trying to use this for smart home and typed this in index.js, but received an error and could not deploy the firebase.
Please help me on how to fix this.
const functions = require('firebase-functions');
const admin = require('firebase-admin');
admin.initializeApp();
const DialogflowApp = require('actions-on-google').DialogflowApp;
exports.receiveAssistantRequests = functions.https.onRequest((request, response) => {
const app = new DialogflowApp({request: request, response: response});
function handlerRequest(app) {
const device = app.getArgument('devices');
const status = app.getArgument('status');
return admin.database().ref(`/automation/${device}/value`).set(status)
.then(snapshot => { //I believe this is where the error is..
app.ask(`Ok, switching ${device} ${status}. Do you want to control anything else?`);
});
}
app.handleRequest(handlerRequest);
});