actions-on-google / actions-on-google-nodejs

Node.js client library for Actions on Google
https://actions-on-google.github.io/actions-on-google-nodejs
Apache License 2.0
899 stars 193 forks source link

Dialogflow IntentHandler not found for intent: #209

Open UJPrasad opened 6 years ago

UJPrasad commented 6 years ago

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!

Fleker commented 6 years ago

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})

UJPrasad commented 6 years ago

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>)
Fleker commented 6 years ago

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

UJPrasad commented 6 years ago

@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"}

Fleker commented 6 years ago

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

UJPrasad commented 6 years ago

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

Fleker commented 6 years ago

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.

UJPrasad commented 6 years ago

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

Fleker commented 6 years ago

What are the exact steps you're taking?

timpron commented 6 years ago

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
Canain commented 6 years ago

@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.

timpron commented 6 years ago

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.

ksreepal commented 6 years ago

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

timpron commented 6 years ago

"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