I am building a Dialogflow agent and am migrating the fulfilment code from Google Cloud Functions over to AWS Lambda. Here is the entry code:
'use strict';
/* CONSTANTS AND GLOBAL VARIABLES */
const functions = require('firebase-functions');
const { dialogflow } = require('actions-on-google');
const app = dialogflow({ debug: true });
const intents = require('./intentsController.js');
app.middleware(conv => {
conv.hasScreen =
conv.surface.capabilities.has('actions.capability.SCREEN_OUTPUT');
conv.hasAudioPlayback =
conv.surface.capabilities.has('actions.capability.AUDIO_OUTPUT');
});
app.intent('Welcome Intent', intents.welcomeIntent)
/* INTENT HANDLERS */
app.intent('Default Fallback Intent', intents.fallBackIntent);
app.intent('Find Multiple Posts Intent', intents.multiplePostsIntent);
exports.testFunction = functions.https.onRequest(app);
When viewing the cloudwatch logs from Lambda, Im getting this error:
"errorType": "Runtime.UnhandledPromiseRejection", "errorMessage": "Error: No intent was provided and fallback handler is not defined.",
When viewing the requests on AWS vs Google Cloud, AWS looks like its keeping the JSON in the request body as a string. Why would this work differently on Lambda and what am I doing wrong here?
It turns out that I was using the wrong API Gateway type. I was creating an http API when I should have used a REST API. Switching over to REST fixed the issue.