actions-on-google-nodejs icon indicating copy to clipboard operation
actions-on-google-nodejs copied to clipboard

Dialogflow IntentHandler not found for intent:

Open UJPrasad opened this issue 7 years ago • 14 comments

Hey everyone!

I've recently got into this issue, that when I'm visiting my actions-on-google node server, it is throwing me an error:

{"error":"Dialogflow IntentHandler not found for intent: "}

This is my basic code for a test Welcome Intent,


const express = require('express')
const bodyParser = require('body-parser')
 
var port = process.env.PORT || 3000;

express().use(bodyParser.json());
express().use(bodyParser.urlencoded({ extended: true }));

const {dialogflow} = require('actions-on-google');

const app = dialogflow();

app.intent('Default Welcome Intent', conv => {
  conv.ask('What do you wanna do next?')
})

express().use(bodyParser.json(), app).listen(port);

I've used the similar code in my another actions and it's live on Assistant. If anybody has faced similar issue please let me know, and also please suggest me if I'm doing something wrong/ why isn't it work.

and by the way here is my package.json

{
  "name": "package-name",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "author": "AuthorName",
  "license": "ISC",
  "dependencies": {
    "actions-on-google": "^2.2.0",
    "body-parser": "^1.18.3",
    "express": "^4.16.3"
  }
}

Thanks!

UJPrasad avatar Aug 13 '18 17:08 UJPrasad

Can you get logs on the request your server is getting? Usually that error would appear if an intent uses fulfillment but isn't defined in the code (ie. "My Second Intent"), leading to a null function.

But looking at the error, is the intent unnamed or whitespace? Hopefully a more verbose request will provide a better look at what you're getting.

You can enable this with an option in the Dialogflow constructor:

const app = dialogflow({ debug: true})

Fleker avatar Aug 13 '18 19:08 Fleker

Hey!

I've enabled that debugging mode and here are the logs,


Request {}
Headers {
  "host": "localhost:3000",
  "user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:61.0) Gecko/20100101 Firefox/61.0",
  "accept": "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8",
  "accept-language": "en-US,en;q=0.5",
  "accept-encoding": "gzip, deflate",
  "connection": "keep-alive",
  "upgrade-insecure-requests": "1"
}
Conversation {
  "responses": [],
  "expectUserResponse": true,
  "digested": false,
  "_responded": false,
  "request": "[Excluded]",
  "headers": "[Excluded]",
  "sandbox": false,
  "input": {},
  "surface": {
    "capabilities": {
      "list": []
    }
  },
  "available": {
    "surfaces": {
      "list": [],
      "capabilities": {
        "surfaces": []
      }
    }
  },
  "user": {
    "raw": {},
    "storage": {},
    "permissions": [],
    "last": {},
    "name": {},
    "entitlements": [],
    "access": {},
    "profile": {}
  },
  "arguments": {
    "parsed": {
      "input": {},
      "list": []
    },
    "status": {
      "input": {},
      "list": []
    },
    "raw": {
      "list": [],
      "input": {}
    }
  },
  "device": {},
  "screen": false,
  "body": "[Excluded]",
  "version": 2,
  "action": "",
  "intent": "",
  "parameters": {},
  "contexts": {
    "input": {},
    "output": {}
  },
  "incoming": {
    "parsed": []
  },
  "query": "",
  "data": {}
}
Error: Dialogflow IntentHandler not found for intent:
    at Function.<anonymous> (J:\node_projects\anurag-samo\node_modules\actions-on-google\dist\service\dialogflow\dialogflow.js:134:31)
    at Generator.next (<anonymous>)
    at J:\node_projects\anurag-samo\node_modules\actions-on-google\dist\service\dialogflow\dialogflow.js:22:71
    at new Promise (<anonymous>)
    at __awaiter (J:\node_projects\anurag-samo\node_modules\actions-on-google\dist\service\dialogflow\dialogflow.js:18:12)
    at Function.handler (J:\node_projects\anurag-samo\node_modules\actions-on-google\dist\service\dialogflow\dialogflow.js:84:16)
    at Object.<anonymous> (J:\node_projects\anurag-samo\node_modules\actions-on-google\dist\assistant.js:55:32)
    at Generator.next (<anonymous>)
    at J:\node_projects\anurag-samo\node_modules\actions-on-google\dist\assistant.js:22:71
    at new Promise (<anonymous>)

UJPrasad avatar Aug 14 '18 16:08 UJPrasad

It's so weird that it's empty. What query are you sending it?

Fleker avatar Aug 14 '18 18:08 Fleker

@Fleker for all the queries it is the same issue. Here I've just tried with an empty post request, or even an empty get request. It shouldn't be like this.

from what I've did for my previous works when we send an empty post or get request, this is what should be returned in JSON with following response,

{"error":"Cannot read property 'payload' of undefined"}

UJPrasad avatar Aug 14 '18 18:08 UJPrasad

Are you just opening up the webpage in a browser, or using something like the Dialogflow simulator?

Fleker avatar Aug 15 '18 17:08 Fleker

For this instance, yes! ( just to show what the problem is.. ) But I've even tried with direct with web integration, this behave same..

UJPrasad avatar Aug 17 '18 10:08 UJPrasad

Well, you can't open up your webhook in a web browser. That's not the expected way to call it, and you are missing a lot information in the request that will prevent you from getting a valid response.

Fleker avatar Aug 17 '18 18:08 Fleker

@Fleker I agree mate! but the point is, it's not working as a WebHook as well in DialogFlow..

UJPrasad avatar Aug 21 '18 04:08 UJPrasad

What are the exact steps you're taking?

Fleker avatar Aug 21 '18 17:08 Fleker

Hi!

I have been trying to use the actions on google node js client library for some days now but I couldn't get it to work. I believe I have the same implementation as you.

I have attached here the web app code, the dialogFlow webhook settings and the error I get. Am I using anything wrongly? Or is there some issue with actions on google right now, as your post is suggesting?

app error webhook settings

timpron avatar Aug 29 '18 07:08 timpron

@timpron So the error on there is that the userStorage data is invalid and thus parsed incorrectly.

Were you previously not using the Actions Node.js library? I would try resetting the actions data then try again with an empty userStorage.

Canain avatar Sep 14 '18 23:09 Canain

Yes, you're right. I forgot to update this thread. The error was that userStorage contained an invalid json string. Right now, there still seems to be some problem with using the said field, it gets reset everytime. I think it's still under development. I'm pausing development using it for now.

timpron avatar Sep 17 '18 00:09 timpron

Hi, I also observed the same error. Any update on the solution. Please. Thank you.

ksreepal avatar Sep 25 '18 08:09 ksreepal

"We apologize if you were inconvenienced by the delay in helping with your issue. We understand the issue you've been experiencing hasn't been resolved. We want you to know we’re working it. You’ll get updates from us on the status of the issue until it’s resolved."

This is the reply what I've been getting foe weeks now. I suggest, you find a workaround for now

timpron avatar Sep 25 '18 10:09 timpron