Reputation: 1069
I am building a bot using MS BotFramework functions and I am trying to use Dialogflow with MS BotFramework but I am failing with setting up configuration. dialogflow-nodejs-client-v2 library requires that GOOGLE_APPLICATION_CREDENTIALS environment variable is set. Which I believe I set :
I've also manually uploaded conf file into the, what I believe is the working directory
Yet bot is still failing. I tried various paths as value of a variable including absolute path : D:\home\site\wwwroot\messages\test-0691d01dae88.json
still with no luck.
Error I am getting is very cryptic :
Exception while executing function: Functions.messages. mscorlib: One or more errors occurred. Error: package.json does not exist at D:\home\site\wwwroot\package.json
at Object.module.exports.exports.find (D:\home\site\wwwroot\.funcpack\index.js:272715:15)
at Object.module.exports.exports.status.OK (D:\home\site\wwwroot\.funcpack\index.js:51739:12)
at __webpack_require__ (D:\home\site\wwwroot\.funcpack\index.js:21:30)
at Object.<anonymous> (D:\home\site\wwwroot\.funcpack\index.js:271412:12)
at __webpack_require__ (D:\home\site\wwwroot\.funcpack\index.js:21:30)
at Object.module.exports.module.exports (D:\home\site\wwwroot\.funcpack\index.js:84837:27)
at __webpack_require__ (D:\home\site\wwwroot\.funcpack\index.js:21:30)
at Object.<anonymous> (D:\home\site\wwwroot\.funcpack\index.js:260961:14)
at __webpack_require__ (D:\home\site\wwwroot\.funcpack\index.js:21:30)
at new GrpcClient (D:\home\site\wwwroot\.funcpack\index.js:132359:25).
It suggest package.json is missing but this error only occurs if I try to use dialog flow to be specific I require recognizer.js file in index.js.
var apiairecognizer_v2 = require('./recognizer');
It's content is :
"use strict";
const dialogflow = require('dialogflow').v2beta1;
const uuid = require('uuid');
// next line causes error
const sessionClient = new dialogflow.SessionsClient();
var ApiAiRecognizer = function(){
};
ApiAiRecognizer.prototype.recognize = function (context, done){
}
module.exports = ApiAiRecognizer;
Commenting out sessionClient line will make bot work.
Any idea how to configure Dialogflow v2 with MS BotFramework functions?
thanks
Upvotes: 2
Views: 722
Reputation: 20091
Error seems straight forward for any node.js application. You are using statement:
var apiairecognizer_v2 = require('./recognizer');
So application is expecting package.json file for installing packages like:
{
"name": "abc",
"devDependencies": {
"dialogflow":"^0.6.0",
"uuid":"^3.3.2",
"recognizer":"^0.0.2"
}
}
it is used for installing package by npm.
Error is that it is expecting package.json with all referenced & dependent packages there in location D:\home\site\wwwroot\package.json
You can either manually add that or try going to that folder if node is installed & npm is used, try
npm install --save recognizer
or
npm install --save-dev recognizer
it will save latest package in package.json.
It seems you are already getting two packages dialogflow
& uuid
resolved using npm without error so issue is missing recognizer
entry in package.json.
Try adding package in package.json there.
Upvotes: 1