BotFramework-Composer icon indicating copy to clipboard operation
BotFramework-Composer copied to clipboard

Bot does not work (no response at all) in 'Test in Web Chat' in Azure Bot Portal but works on Bot Framework Composer

Open pra-navi opened this issue 1 year ago • 0 comments

Describe the bug

I am creating a normal chatbot that connects to my external api for generating responses.

I published my bot by creating a publishing profile on Bot Framework Composer, pushing the entire bot files to github. I created a Microsoft App Service called testbot and within deployment center set the source as this github repository with Node 16.

I have a Azure Bot called TestBot for eg. In the configuration, I have set the messaging endpoint as that which is generated through GitHub actions but with /api/messages.

My appsettings.json on the GitHub repository:

{
  "customFunctions": [],
  "defaultLanguage": "en-us",
  "defaultLocale": "en-us",
  "importedLibraries": [],
  "languages": [
    "en-us"
  ],
  "Logging": {
    "LogLevel": {
      "Default": "Information",
      "Microsoft": "Warning",
      "Microsoft.Hosting.Lifetime": "Information"
    }
  },
  "luFeatures": {
    "enableCompositeEntities": true,
    "enableListEntities": true,
    "enableMLEntities": true,
    "enablePattern": true,
    "enablePhraseLists": true,
    "enablePrebuiltEntities": true,
    "enableRegexEntities": true
  },
  "luis": {
    "authoringEndpoint": "",
    "authoringRegion": "",
    "defaultLanguage": "en-us",
    "endpoint": "",
    "environment": "composer",
    "name": "TestAppBot"
  },
  "MicrosoftAppId": {from Azure Bot > Config > App ID},
  "MicrosoftAppPassword": {fromAzure Bot > Config > App ID > Manage Passwords > client secrets > value},
  "publishTargets": [
    {
      "name": "TestBot",
      "type": "azurePublish",
      "configuration": "{\"name\":\"Microsoft Azure Sponsorship\",\"environment\":\"dev\",\"tenantId\":\"xxx\",\"hostname\":\"{messaging endpoint without /api/messages}\",\"runtimeIdentifier\":\"win-x64\",\"resourceGroup\":\"yyy\",\"botName\":\"TestBot\",\"subscriptionId\":\"zzz\",\"region\":\"westeurope\",\"appServiceOperatingSystem\":\"linux\",\"scmHostDomain\":\"azurewebsites.net\",\"luisResource\":\"\",\"settings\":{\"applicationInsights\":{\"InstrumentationKey\":\"\",\"connectionString\":\"\"},\"cosmosDb\":{\"cosmosDBEndpoint\":\"\",\"authKey\":\"\",\"databaseId\":\"\",\"containerId\":\"\"},\"blobStorage\":{\"connectionString\":\"\",\"container\":\"\"},\"luis\":{\"authoringKey\":\"\",\"authoringEndpoint\":\"\",\"endpointKey\":\"\",\"endpoint\":\"\",\"region\":\"\"},\"qna\":{\"subscriptionKey\":\"\",\"endpoint\":\"\"},\"MicrosoftAppId\":\"{from Azure Bot > Config > App ID}\",\"MicrosoftAppPassword\":\"{fromAzure Bot > Config > App ID > Manage Passwords > client secrets > value}\"}}",
      "lastPublished": "2024-07-30T14:13:52.274Z"
    }
  ],
  "qna": {
    "hostname": "",
    "knowledgebaseid": "",
    "qnaRegion": "westus"
  },
  "runtime": {
    "command": "npm run dev --",
    "customRuntime": true,
    "key": "adaptive-runtime-js-webapp",
    "path": "../"
  },
  "runtimeSettings": {
    "adapters": [],
    "features": {
      "removeRecipientMentions": false,
      "showTyping": false,
      "traceTranscript": false,
      "useInspection": false,
      "setSpeak": {
        "voiceFontName": "en-US-JennyNeural",
        "fallbackToTextForSpeechIfEmpty": true
      }
    },
    "components": [],
    "skills": {
      "allowedCallers": []
    },
    "storage": "",
    "telemetry": {
      "logActivities": true,
      "logPersonalInformation": false,
      "options": {
        "connectionString": ""
      }
    }
  },
  "skillConfiguration": {},
  "skillHostEndpoint": "http://localhost:3980/api/skills"
}

My Github repo is called TestAppBot (in case it appears here and there in the code and you are not sure why).

These are the error messages in the log after I send 'hi' on 'Test Web Chat' on Azure App Service > Web App > Log stream:

Connected!
2024-09-24T14:23:57  Welcome, you are now connected to log-streaming service.Starting Log Tail -n 10 of existing logs ----/appsvctmp/volatile/logs/runtime/container.log
2024-09-24T13:39:07.4808463Z Startup : xxx
2024-09-24T13:39:07.5050523Z Configure Services : xxx
2024-09-24T13:39:07.8765782Z Configure : xxx
2024-09-24T13:39:08.0533040Z Setting Up Routes : xxx
2024-09-24T13:39:08.9569310Z Exiting Configure : xxx
2024-09-24T13:39:09.0920936Z Hosting environment: Production
2024-09-24T13:39:09.0969218Z Content root path: /opt/Kudu
2024-09-24T13:39:09.0973782Z Now listening on: http://0.0.0.0:8181
2024-09-24T13:39:09.0977201Z Application started. Press Ctrl+C to shut down.
2024-09-24T14:09:15.3491339Z Deploy AsyncEnding Log Tail of existing logs ---Starting Live Log Stream ---
2024-09-24T14:24:36.5374078Z    _____
2024-09-24T14:24:36.5385254Z   /  _  \ __________ _________   ____
2024-09-24T14:24:36.5385444Z  /  /_\  \\___   /  |  \_  __ \_/ __ \
2024-09-24T14:24:36.5385559Z /    |    \/    /|  |  /|  | \/\  ___/
2024-09-24T14:24:36.5385610Z \____|__  /_____ \____/ |__|    \___  >
2024-09-24T14:24:36.5385679Z         \/      \/                  \/
2024-09-24T14:24:36.5385739Z A P P   S E R V I C E   O N   L I N U X
2024-09-24T14:24:36.5385798Z
2024-09-24T14:24:36.5385844Z Documentation: http://aka.ms/webapp-linux
2024-09-24T14:24:36.5385888Z NodeJS quickstart: https://aka.ms/node-qs
2024-09-24T14:24:36.5385927Z NodeJS Version : v16.20.2
2024-09-24T14:24:36.5385987Z Note: Any data outside '/home' is not persisted
2024-09-24T14:24:36.5386032Z
2024-09-24T14:24:36.7968984Z Starting OpenBSD Secure Shell server: sshd.
2024-09-24T14:24:36.8945634Z Starting periodic command scheduler: cron.
2024-09-24T14:24:36.9678449Z Could not find build manifest file at '/home/site/wwwroot/oryx-manifest.toml'
2024-09-24T14:24:36.9689944Z Could not find operation ID in manifest. Generating an operation id...
2024-09-24T14:24:36.9706409Z Build Operation ID: 56d278df-f67a-47c1-a8d9-f69d0ab6d0ce
2024-09-24T14:24:37.2933472Z Environment Variables for Application Insight's IPA Codeless Configuration exists..
2024-09-24T14:24:38.1059859Z Writing output script to '/opt/startup/startup.sh'
2024-09-24T14:24:38.4624130Z Running #!/bin/sh
2024-09-24T14:24:38.4624627Z
2024-09-24T14:24:38.4624686Z # Enter the source directory to make sure the script runs where the user expects
2024-09-24T14:24:38.4624740Z cd "/home/site/wwwroot"
2024-09-24T14:24:38.4624778Z
2024-09-24T14:24:38.4624817Z export NODE_PATH=/usr/local/lib/node_modules:$NODE_PATH
2024-09-24T14:24:38.4624897Z if [ -z "$PORT" ]; then
2024-09-24T14:24:38.4624936Z 		export PORT=8080
2024-09-24T14:24:38.4624973Z fi
2024-09-24T14:24:38.4625007Z
2024-09-24T14:24:38.4625044Z node index.js
2024-09-24T14:25:01.3918310Z server listening on port 8080
2024-09-24T14:25:25.2383182Z Terminated
2024-09-24T14:25:40.5817959Z [onTurnError] unhandled error DialogContextError: The clientSecret parameter is required.
2024-09-24T14:25:40.5818970Z     at /home/site/wwwroot/node_modules/botbuilder-dialogs/lib/dialogContext.js:40:19
2024-09-24T14:25:40.5819023Z     at Generator.throw (<anonymous>)
2024-09-24T14:25:40.5819056Z     at rejected (/home/site/wwwroot/node_modules/botbuilder-dialogs/lib/dialogContext.js:6:65)
2024-09-24T14:25:40.5819088Z     at processTicksAndRejections (node:internal/process/task_queues:96:5) {
2024-09-24T14:25:40.5819119Z   error: Error: The clientSecret parameter is required.
2024-09-24T14:25:40.5819153Z       at Object.validateStringParameter (/home/site/wwwroot/node_modules/adal-node/lib/argument.js:37:13)
2024-09-24T14:25:40.5819212Z       at AuthenticationContext.acquireTokenWithClientCredentials (/home/site/wwwroot/node_modules/adal-node/lib/authentication-context.js:282:14)
2024-09-24T14:25:40.5819249Z       at /home/site/wwwroot/node_modules/botframework-connector/lib/auth/microsoftAppCredentials.js:49:48
2024-09-24T14:25:40.5819277Z       at new Promise (<anonymous>)
2024-09-24T14:25:40.5825199Z       at MicrosoftAppCredentials.<anonymous> (/home/site/wwwroot/node_modules/botframework-connector/lib/auth/microsoftAppCredentials.js:48:40)
2024-09-24T14:25:40.5825284Z       at Generator.next (<anonymous>)
2024-09-24T14:25:40.5825328Z       at /home/site/wwwroot/node_modules/botframework-connector/lib/auth/microsoftAppCredentials.js:15:71
2024-09-24T14:25:40.5825364Z       at new Promise (<anonymous>)
2024-09-24T14:25:40.5825417Z       at __awaiter (/home/site/wwwroot/node_modules/botframework-connector/lib/auth/microsoftAppCredentials.js:11:12)
2024-09-24T14:25:40.5825465Z       at MicrosoftAppCredentials.refreshToken (/home/site/wwwroot/node_modules/botframework-connector/lib/auth/microsoftAppCredentials.js:46:16),
2024-09-24T14:25:40.5825513Z   dialogContext: {
2024-09-24T14:25:40.5825553Z     activeDialog: 'SendActivity[${SendActivity_Greeting()}]',
2024-09-24T14:25:40.5825586Z     parent: 'TestAppBot',
2024-09-24T14:25:40.5825622Z     stack: [ [Object], [Object], [Object], [Object] ]
2024-09-24T14:25:40.5825657Z   }
2024-09-24T14:25:40.5825693Z }
2024-09-24T14:25:45.6195821Z user.IsNew ->
2024-09-24T14:25:45.6345860Z user.IsNew ->
2024-09-24T14:25:45.6440742Z user.Data ->
2024-09-24T14:25:45.6660326Z [onTurnError] unhandled error DialogContextError: user.data is not a list or array.
2024-09-24T14:25:45.6660825Z     at /home/site/wwwroot/node_modules/botbuilder-dialogs/lib/dialogContext.js:40:19
2024-09-24T14:25:45.6660868Z     at Generator.throw (<anonymous>)
2024-09-24T14:25:45.6660900Z     at rejected (/home/site/wwwroot/node_modules/botbuilder-dialogs/lib/dialogContext.js:6:65)
2024-09-24T14:25:45.6660932Z     at processTicksAndRejections (node:internal/process/task_queues:96:5) {
2024-09-24T14:25:45.6660961Z   error: 'user.data is not a list or array.',
2024-09-24T14:25:45.6661000Z   dialogContext: {
2024-09-24T14:25:45.6661031Z     activeDialog: 'SetProperty[=`user.data`]2',
2024-09-24T14:25:45.6661112Z     parent: 'TestAppBot',
2024-09-24T14:25:45.6661142Z     stack: [ [Object], [Object], [Object] ]
2024-09-24T14:25:45.6661170Z   }
2024-09-24T14:25:45.6661212Z }

to clarify user.data is supposed to be an array, thats how it works on the Bot Framework Emulator. image image image

Version

These are the error messages in the log after I send 'hi' on 'Test Web Chat'

v2.1.2

Browser

  • [ ] Electron distribution
  • [X] Chrome
  • [ ] Safari
  • [ ] Firefox
  • [ ] Edge These are the error messages in the log after I send 'hi' on 'Test Web Chat'

OS

  • [ ] macOS
  • [X ] Windows
  • [ ] Ubuntu

pra-navi avatar Sep 24 '24 15:09 pra-navi