0

I am trying to connect to my Luis app using Bot Emulator.

I have an intent named "Greet" in the Luis app, and am testing it in the Bot Emulator.

The Bot Emulator keeps replying Oops there is something went wrong., after I typed in my training phrase.

For example, "Hi", in the "Greet" intent.

Please tell me what I did was wrong. Thank you very much!

The following pictures are the screenshot of Bot Emulator and the terminal returning an error message.

Bot Emulator showing "Oops, something went wrong and we need to start again after I said "Hello.":

Bot Emulator showing "Oops, something went wrong and we need to start again after I said "Hello."

Cache gave an error message at request._callback and self._callback:

Cache gave an error message at request._callback and self._callback

The following is my NodeJS code (I had my LuisAPIKey and LuisAppId in my code locally, here I deleted them):

var restify = require('restify');
var builder = require('botbuilder');
var server = restify.createServer();

server.listen(process.env.port || process.env.PORT || 3987, function () {
     console.log('%s listening to %s', server.name, server.url); 
});
var connector = new builder.ChatConnector();

server.post('/api/messages', connector.listen());

var bot = new builder.UniversalBot(connector);

var luisAppId = '';
var luisAPIKey = '';
var luisAPIHostName = 'https://westus.api.cognitive.microsoft.com';

const luisModelUrl = 'https://' + luisAPIHostName + '/luis/v2.0/apps' + luisAppId + '?subscription-key=' + luisAPIKey;

var recognizer = new builder.LuisRecognizer(luisModelUrl);
var intents = new builder.IntentDialog({
    recognizers: [recognizer]
})

bot.dialog('/', intents);

intents.matches('Greet', (session) =>{
    session.send("Hello there! How can I help you today?");
})
.onDefault((session, args, next) => {
    console.log(args);
    session.send("Sorry, I did not understand.");
})

1 Answer 1

2

It seems that your error message is not complete outputed, i reproduce your issue, and the error message shoule be:

Error: { "statusCode": 404, "message": "Resource not found" }
UniversalBot.js:548
    at Request._callback (c:\WorkSpace\bot framework\nodejs test\node_modules\botbuilder\lib\dialogs\LuisRecognizer.js:101:31)
    at Request.self.callback (c:\WorkSpace\bot framework\nodejs test\node_modules\request\request.js:185:22)
    at Request.emit (events.js:180:13)
    at Request.emit (domain.js:421:20)
    at Request.<anonymous> (c:\WorkSpace\bot framework\nodejs test\node_modules\request\request.js:1157:10)
    at Request.emit (events.js:180:13)
    at Request.emit (domain.js:421:20)
    at IncomingMessage.<anonymous> (c:\WorkSpace\bot framework\nodejs test\node_modules\request\request.js:1079:12)
    at Object.onceWrapper (events.js:272:13)
    at IncomingMessage.emit (events.js:185:15)
/ - ERROR: { "statusCode": 404, "message": "Resource not found" }

So the root case, it that you concoct the LUIS URL in incorrect format. you missed \ after /luis/v2.0/apps, please modify to:

const luisModelUrl = 'https://' + luisAPIHostName + '/luis/v2.0/apps/' + luisAppId + '?subscription-key=' + luisAPIKey;
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.