0

I am trying to leverage AWS Lambda as the webhook for dialogflow call. I want to use all the agent/google actions libraries.

So I copied the sample code and pasted it to Lambda what we get in Dialogflow console. I installed all the npm libraries. But when testing I am getting this issue:

TypeError: Cannot read property 'result' of undefined
    at new WebhookClient (/var/task/node_modules/dialogflow-fulfillment/src/dialogflow-fulfillment.js:84:27)
    at exports.dialogflowFirebaseFulfillment.functions.https.onRequest (/var/task/index.js:13:17)
    at cloudFunction (/var/task/node_modules/firebase-functions/lib/providers/https.js:57:9)

I have exposed Lambda earlier but as the requirement is for the Dialogflow, I am not able to do so.

Note: I am passing the same request payload in Google Cloud and AWS Lambda, Google Cloud is returning correct but Lambda is returning error as mentioned above.

Not sure if I am missing any step or my understanding is wrong here.

Please help.

stackjohnny
  • 645
  • 3
  • 7
  • 22
  • Have you enabled [Billing Account](https://stackoverflow.com/questions/42784135/cloud-functions-for-firebase-billing-account-not-configured) ( ex Blaze Plan ) in Firebase? – Sairaj Sawant Dec 09 '18 at 10:05
  • I dont need Firebase right as I want to use AWS Lambda for the same. – stackjohnny Dec 09 '18 at 14:20

1 Answers1

0

Can you please post some code here as well for more reference?

If you've installed the required npm libraries for dialog-flow then it should work as far as I can understand.

Also please note if you're trying to access input request parameters of DialogFlow such as {"userId": string,"idToken " string} it will not be accessible by default in the lambda events & hence you may face errors like Cannot read property 'result.originalRequest.user.idToken' of undefined.

You'll have to first enable google integrations on the fulfillment intents so that google can ask users the permission to send these attributes in the request body.

Also since this was asked many months ago please let me know if your issue was resolved.

Grzegorz Smulko
  • 2,525
  • 1
  • 29
  • 42