Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[nodejs][12.nlp-with-luis] Authorization error #947

Closed
rsweetland opened this issue Nov 17, 2018 · 3 comments
Closed

[nodejs][12.nlp-with-luis] Authorization error #947

rsweetland opened this issue Nov 17, 2018 · 3 comments

Comments

@rsweetland
Copy link

Describe the bug

Following readme instructions (including double-verifying all credentials) still results in authorization errors.

Possibly related, the below line in the readme conflicts with the page it links to, which shows both authoringKey and subscriptionKey. I tried all combinations without result.

The Version is listed on the page. Note: Enter the either "authoringKey" OR "subscriptionKey", not both. See an example .bot service configuration for using LUIS here.

Resulting config:

{
    "type": "luis",
    "name": "BOT_CENTRAL", // matches LUIS_CONFIGURATION in index.js
    "appId": "[redacted]", 
    "version": "0.1", //matches version number on luis.ai
    "authoringKey": "[redacted]",
    "subscriptionKey": "[redacted]",
    "region": "westus",  // matches region in luis.ai
    "id": "83"
}

To Reproduce

Steps to reproduce the behavior:

  1. Follow instructions in readme (including prerequisites)
  2. npm start
  3. Connect emulator, bot starts
  4. Type "Add Event" in emulator
  5. Observe the following error in console:
[onTurnError]: Error: Response 401: The key used is invalid, malformed, empty, or doesn't match the region.
BotFrameworkAdapter.processActivity(): 500 ERROR - TypeError: this.addUserAgentInfo is not a function
(node:73552) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 5): Error: TypeError: this.addUserAgentInfo is not a function

And this error in the emulator:

"\"TypeError: this.addUserAgentInfo is not a function\""

Additional context

nlp-with-luis version from package.json is 1.0.0
I'm running Node v8.9.1

[bug]

@sgellock
Copy link
Member

There are two issues called out in this Issue.: one of the issues pertains to LUIS creds, the other issue is why the onTurnError handler is firing with a TypeError.

I submitted PR #948 to add some additional clarity to the sample's README, specifically pertaining to LUIS setup. That said, I am able to create a LUIS app, import the language file (.json), train and publish the model, and use the key and region data found on the Luis.ai Keys and Endpoint page to update the .bot file. Once I do the above steps, and address the second issue, see below, I am able to run the sample successfully.

For the second issue, the TypeError, there is a temporary workaround that will fix the TypeError. Perform the following commands from a shell console:

$ cd 12.nlp-with-luis
$ npm install
$ npm uninstall ms-rest-js ms-rest-azure-js
$ npm i [email protected] [email protected]

The TypeError is a result of a breaking change introduced by a dependent component we us in the SDK. We''ve logged an issue against that team to fix there breaking change. That can be tracked here:
Azure/ms-rest-js#276.

The PR microsoft/botbuilder-js#644 will address the issue in the SDK, until the above Issue is resolved.

We will publish new SDK bits that will lock to a previous (unbroken) version of that dependency. ETA for that is tracking to Monday of this coming week.

@rsweetland, I'm adding the support team to the issue. They can help you further if my above data doesn't fully get you up and running

@rsweetland
Copy link
Author

Solved! Thanks for answering and pushing a fix so quickly.

The additional steps added to the readme (train + publish on luis.ai) were my missing steps. It would be nice if Luis's error message suggested that. For example:

Error: Response 401: The key used is invalid, malformed, empty, doesn't match the region or your model has not yet been published.

I also tested with an invalid key and confirmed the type error is not happening.

@sgellock sgellock removed the Support label Nov 17, 2018
@sgellock
Copy link
Member

Thanks for the feedback on the improved error message. We're not able to provide a better error message as there isn't an api we can use to detect the scenario.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants