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

Deploying a bot to azure with luis functionality is completely broken and I believe it is the LUISRecognizer class #2310

Closed
xtianus79 opened this issue Apr 11, 2020 · 6 comments
Assignees
Labels
Bot Services Required for internal Azure reporting. Do not delete. Do not change color. customer-replied-to Indicates that the team has replied to the issue reported by the customer. Do not delete. customer-reported Issue is created by anyone that is not a collaborator in the repository.

Comments

@xtianus79
Copy link

From 9pm last night until 7am this morning I could not get the bot to deploy to Azure through any means. Either sending a zip file package or through continuous deployment. Since this is such an emergency issue for us and I don't know where to else to post this report to I will try a couple different places.

As a mitigation step to see what was going on I tried to upload samples to Azure to see if those would work and they would not.

Everything, of course, works in a local development environment.

The seems to be with the a node package for LUIS. The Luis recognizer specifically. It keeps saying there is an undefined intent.

Before I show sample error reporting I want to show you some of the other difficulties we experienced trying to get this to work.

  1. Lets start with the continuous deployment.
    Whatever environment that we are deploying to doesn't seem to use Nodejs correctly at all. It keeps giving a tsc error. The package is included and is there in the deployment. that bug add launch.json for VSCode #1.
    Here is a stackoverflow question on the exact matter with no answer since February.
    this link here is from 4 years ago and seems to be the root of the issue.

Here is a quote from an answer someone gave regarding the issue.

Right...
After a lot of heartache I finally got this going. The fundamental issue is that my dev box is Windows and the Azure Web App is Linux. Therefore deploy.cmd is not going to fly at all. You need a deploy.sh bash script to run on Linux. There is apparently no way to generate it on Windows...you need fire up your Linux box and use
azure site deploymentscript --node

Is this the case and if so why isn't this officially communicated? I've always developed on a mac at home i'm on a pc so this is painful as that poster suggested.

  1. Deploying the zip file directly
    I posted number 1 first because I think it may relate to number this issue. Everything works fine locally and then falls apart upon deployment.

All it gives repeatedly is this error:

[info] The logging level is 'Information'. To change this, go to the 'Diagnostics Logs' page in your app settings and change the 'Application Logging' setting.
Running dialog with Message Activity.

 [onTurnError] unhandled error: TypeError: Cannot read property 'intents' of undefined
2020-04-11T19:26:39  PID[16888] Information Loading modules from D:\Program Files (x86)\MiddlewareModules\1.2.7\Microsoft.Azure.AppService.Middleware.Modules.dll
2020-04-11T19:26:39  PID[16888] Verbose     Detected application setting 'WEBSITE_AUTH_LOGOUT_PATH' = '/.auth/logout'
2020-04-11T19:26:39  PID[16888] Verbose     Detected application setting 'WEBSITE_AUTH_ENABLED' = 'False'
2020-04-11T19:26:40  PID[16888] Warning     Error reading value from environment variable WEBSITE_AUTH_COOKIE_EXPIRATION_MODE. 0 value used for cookie expiration setting instead.
2020-04-11T19:26:40  PID[16888] Verbose     Detected application setting 'WEBSITE_CORS_ALLOWED_ORIGINS' = 'https://portal.azure.com,https://botservice.hosting.portal.azure.net,https://botservice-ms.hosting.portal.azure.net,https://hosting.onecloud.azure-test.net/'
2020-04-11T19:26:40  PID[16888] Verbose     Detected application setting 'WEBSITE_CORS_SUPPORT_CREDENTIALS' = 'False'
2020-04-11T19:26:41  PID[16888] Verbose     Detected application setting 'WEBSITE_AUTH_LOGOUT_PATH' = '/.auth/logout'
2020-04-11T19:26:41  PID[16888] Verbose     Detected application setting 'WEBSITE_AUTH_ENABLED' = 'False'
2020-04-11T19:26:41  PID[16888] Warning     Error reading value from environment variable WEBSITE_AUTH_COOKIE_EXPIRATION_MODE. 0 value used for cookie expiration setting instead.
2020-04-11T19:26:41  PID[16888] Verbose     Detected application setting 'WEBSITE_CORS_ALLOWED_ORIGINS' = 'https://portal.azure.com,https://botservice.hosting.portal.azure.net,https://botservice-ms.hosting.portal.azure.net,https://hosting.onecloud.azure-test.net/'
2020-04-11T19:26:41  PID[16888] Verbose     Detected application setting 'WEBSITE_CORS_SUPPORT_CREDENTIALS' = 'False'
2020-04-11T19:26:41  PID[16888] Verbose     Detected application setting 'WEBSITE_AUTH_SIGNING_KEY' = '18****'
2020-04-11T19:26:41  PID[16888] Verbose     Detected application setting 'WEBSITE_AUTH_ENCRYPTION_KEY' = 'D0****'
(node:7312) [DEP0005] DeprecationWarning: Buffer() is deprecated due to security and usability issues. Please use the Buffer.alloc(), Buffer.allocUnsafe(), or Buffer.from() methods instead.

restify listening to http://undefined:undefined

Get Bot Framework Emulator: https://aka.ms/botframework-emulator

To talk to your bot, open the emulator select "Open Bot"
Running dialog with Message Activity.

 [onTurnError] unhandled error: TypeError: Cannot read property 'intents' of undefined

Hopefully you can diagnose this issue. If I need to start a linux box I will but please advise if this is the issue and what can be done to fix it.

@dmvtech dmvtech added Bot Services Required for internal Azure reporting. Do not delete. Do not change color. customer-reported Issue is created by anyone that is not a collaborator in the repository. labels Apr 13, 2020
@Zerryth
Copy link
Contributor

Zerryth commented Apr 13, 2020

@xtianus79 I actually ran into your "TypeError: Cannot read property 'intents' of undefine error locally, just trying to fire up the 13.core-bot sample locally. Investigating further to figure out the underlying issue

image

So far I've done:

  • Create a LUIS app using the FlightBooking.json model
  • Published to Production in luis.ai portal
  • Sample 13.core-bot: npm i, npm audit fix (as there were 5 low severity vulnerabilities), npm start
  • Sent message to bot book a flight from paris to tokyo for tomorrow

=> Cannot read property 'intents' of undefined

@Zerryth Zerryth added the customer-replied-to Indicates that the team has replied to the issue reported by the customer. Do not delete. label Apr 13, 2020
@Zerryth
Copy link
Contributor

Zerryth commented Apr 14, 2020

Alright, so I actually managed to successfully deploy a LUIS-using bot following the Deploy your bot article, which is via zip deployment.

Previously I had gotten the same error as you, because I had accidentally used the wrong LUIS credentials in the .env file (whoops).

Specifics

  • Used 13.core-bot sample. This sample uses the newer V3 LUIS API.
  • Used core-bot's FlightBooking.json as a cognitive model. Published using production endpoint.
  • Ran bot locally to ensure LUIS model and credentials are integrated into bot correctly
  • zip deployment: Deploy your bot article
Deployment Commands Ran
  • az ad app create --display-name "ashCoreBot" --password "..." --available-to-other-tenants

  • az deployment create --template-file "./deploymentTemplates/template-with-new-rg.json" --location centralus --parameters appId="xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" appSecret="..." botId="ashCoreBot" botSku=S1 newAppServicePlanName="ashCoreBotServicePlan" newWebAppName="ashCoreBotWebApp" groupName="ashCoreBot" groupLocation="centralus" newAppServicePlanLocation="centralus" --name "ashCoreBotAppService"

  • az bot prepare-deploy --code-dir "." --lang Javascript

  • az webapp deployment source config-zip --resource-group "ashCoreBot" --name "ashCoreBotWebApp" --src "code.zip"

    • where "code" was the name of the folder I zipped everything into

@Zerryth
Copy link
Contributor

Zerryth commented Apr 14, 2020

@xtianus79 let's explore the .zip deployment, since it's the set of instructions linked to in our samples' READMEs and I had successfully deployed following it

Just reading your error log, it seems like it can't access your intents, maybe because of your credentials in the .env file.

2020-04-11T19:26:40 PID[16888] Warning Error reading value from environment variable WEBSITE_AUTH_COOKIE_EXPIRATION_MODE. 0 value used for cookie expiration setting instead.

I see you say that the bot works locally, however when you are running the zip deployment, are you making sure to include the LUIS credentials in the .env file when you zip up everything as well?


Additional Context for when I broke bot with cannot read property 'intents' of undefined

LuisRecognizer.recognize() eventually tries to make a fetch() call to the LUIS API, based on the credentials you pass in and any recognizer options you set up. In my case when I elicited the error, the credentials were incorrect, so it malformed the request URI.
Properly formed URI example that the LuisRecognizer fetches: "https://westus.api.cognitive.microsoft.com/luis/prediction/v3.0/apps/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/slots/production/predict?verbose=true&log=true&show-all-intents=false"

With the malformed credentials/URI, the result returned from fetch() was undefined
Then when it tries to parse the data, it blows up when it tries to access the intent prop. in an undefined result
image

@Zerryth
Copy link
Contributor

Zerryth commented Apr 20, 2020

Closing due to inactivity and also being able to successfully deploy using instructions linked in the sample readmes.

@Zerryth Zerryth closed this as completed Apr 20, 2020
@apoorvanand
Copy link

apoorvanand commented May 1, 2020

this issues still exists in local bot emulator also.

@apoorvanand
Copy link

apoorvanand commented May 1, 2020

@Zerryth Can you please help in resolving this .Please update readme to deploy in production

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bot Services Required for internal Azure reporting. Do not delete. Do not change color. customer-replied-to Indicates that the team has replied to the issue reported by the customer. Do not delete. customer-reported Issue is created by anyone that is not a collaborator in the repository.
Projects
None yet
Development

No branches or pull requests

4 participants