microsoft / BotFramework-Composer

Dialog creation and management for Microsoft Bot Framework Applications
https://docs.microsoft.com/en-us/composer/
MIT License
869 stars 372 forks source link

Chatbot can't be published to Azure #9192

Closed taoofstefan closed 2 years ago

taoofstefan commented 2 years ago

Describe the bug

I created a bot in the composer (with LUIS integration). It works fine in the integrated Web Chat and Emulator. When I try to publish the bot to azure I get the following message:

{"name":"CREATE_APP_REGISTRATION","message":"App create failed! Please file an issue on Github.","stack":"Error\n at new CustomizeError (C:\Users\stefa\AppData\Local\Programs\Bot Framework Composer\resources\app.asar.unpacked\extensions\azurePublish\dist\extension.js:276418:25)\n at createCustomizeError (C:\Users\stefa\AppData\Local\Programs\Bot Framework Composer\resources\app.asar.unpacked\extensions\azurePublish\dist\extension.js:276423:10)\n at BotProjectProvision.createApp (C:\Users\stefa\AppData\Local\Programs\Bot Framework Composer\resources\app.asar.unpacked\extensions\azurePublish\dist\extension.js:277931:17)"}. See provision.BigBenChatbot.log in your bot folder

Version

Version: 2.1.2 Electron: 8.2.4 Chrome: 80.0.3987.165 NodeJS: 12.13.0 V8: 8.0.426.27-electron.0

Browser

OS

To Reproduce

Steps to reproduce the behavior:

  1. Go to 'Publish'

  2. Click on 'add new'

  3. I filled out the questions

  4. I used "create a new resource"

  5. image

  6. I only used the required resources (which should all be free or zero costs) image

  7. I clicked "next" then "create", then the "provisioning" start, followed by the error message. {"name":"CREATE_APP_REGISTRATION","message":"App create failed! Please file an issue on Github.","stack":"Error\n at new CustomizeError (C:\Users\stefa\AppData\Local\Programs\Bot Framework Composer\resources\app.asar.unpacked\extensions\azurePublish\dist\extension.js:276418:25)\n at createCustomizeError (C:\Users\stefa\AppData\Local\Programs\Bot Framework Composer\resources\app.asar.unpacked\extensions\azurePublish\dist\extension.js:276423:10)\n at BotProjectProvision.createApp (C:\Users\stefa\AppData\Local\Programs\Bot Framework Composer\resources\app.asar.unpacked\extensions\azurePublish\dist\extension.js:277931:17)"}. See provision.BigBenChatbot.log in your bot folder

Expected behavior

Follow the above and publishing the bot is successful (I don't exactly know yet what comes afterwards).

Screenshots

Additional context

I have a student account, in case this is relevant.

abechelli commented 2 years ago

@taoofstefan i had the same problem and then i requested the admin of azure to give me function to create application register in the azure and this resolved the issue, try this

abechelli commented 2 years ago

This link could be helps you https://github.com/microsoft/BotFramework-Composer/issues/8283

taoofstefan commented 2 years ago

@taoofstefan i had the same problem and then i requested the admin of azure to give me function to create application register in the azure and this resolved the issue, try this

Thanks for the tip, I have the role "Service administrator" but added the role "Contributor". It still doesn't work.

What else can I do? I really would see the bot working on a website. I don't have to publish it for my grading, but it would help.

dmvtech commented 2 years ago

@taoofstefan For the account that you used to login (to Composer), is the tenant you selected the 'home' tenant or is it a guest of the tenant you selected?

taoofstefan commented 2 years ago

@dmvtech I use the same account for everything (composer, azure, LUIS), the one that I got from / is linked to my university.

Justin4Tes commented 2 years ago

@taoofstefan I have been experiencing almost the same exact issue. The only difference is that I'm not using a student account and have no LUIS integration. Assigning myself administrator and contributor role did not help either.

As for the other workaround suggested in #8283:

As a work around, create manually the application on Azure AD, save the App ID and Secret value, go to your bot resource group and create an Azure Bot (since Bot channels are deprecated) and use the App info. After that, import only the App information using composer publishing profile and save, edit the profile and choose create new resoures and the wizard will take care of the rest.

I was a little confused about how to implement it. If you don't mind to share, what was your step-by-step process for carrying out this workaround?

Justin4Tes commented 2 years ago

Update: I've asked a friend to recreate my bot composer configuration and published it with the same publishing profile settings.

Somehow it worked flawlessly on her end. Therefore I'm assuming the problem resides in my Azure settings (subscription, active directory, authentication management etc.) instead of the publishing profile. I'm leaning towards just nuking the whole resource group and rebuild it from scratch.

@taoofstefan Hope this helps.

taoofstefan commented 2 years ago

@Justin4Tes thanks for all the input.

I haven't fully tried the workaround yet. It's a little difficult if you don't exactly know what you are doing.

On another note, I still think there seems to be something wrong with the composer. I can't publish the bot via Composer with existing or new resources. But I managed to publish the same both, with the same account via Visual Studio. It doesn't seem to me it's the account structure that has a problem, but the Bot Framework Composer.

It would be great to get some feedback from the Contributors here about this.

I will retry publishing via Visual Studio and the workaround too. When I tried it yesterday it wasn't working, as I got a 502 error that I wasn't able to resolve.

taoofstefan commented 2 years ago

So, I figured it out and it really is a rights problem. My account, despite having in principal the correct rights, has no rights to register app via the Azure portal. I can only assume that the Bot Framework Composer uses this way in the background. My account is allowed to register app via PowerShell or Visual Code (that's why one way worked and not the other).

I created a private account and was able to deploy the bot via Composer. It is still not working correctly though, as I get a 404 error when I want to test it in the Web Chat integrated in the Azure Bot.

Just to be clear, my bot, including all the LUIS based intents work fine within the Composer and Emulator. It isn't working after publishing into the Azure Bot. It also isn't working if I build and run the same bot via Visual Studio (error 404) in the Emulator and Azure Web Chat.

There are some issues online about this but I wasn't able to see what I did wrong.

dmvtech commented 2 years ago

So, I figured it out and it really is a rights problem. My account, despite having in principal the correct rights, has no rights to register app via the Azure portal. I can only assume that the Bot Framework Composer uses this way in the background.

That is correct.

My account is allowed to register app via PowerShell or Visual Code (that's why one way worked and not the other).

Interesting!!! Good to know.

I created a private account and was able to deploy the bot via Composer. It is still not working correctly though, as I get a 404 error when I want to test it in the Web Chat integrated in the Azure Bot.

Can you check the App Service Editor console and output windows when getting the 404 and see what additional information might help us out?

Just to be clear, my bot, including all the LUIS based intents work fine within the Composer and Emulator. It isn't working after publishing into the Azure Bot.

Yeah, seems like maybe not everything is getting published. Go ahead and check the app service editor console and output windows as mentioned above and see where that leads us.

It also isn't working if I build and run the same bot via Visual Studio (error 404) in the Emulator and Azure Web Chat.

Are you copying all the needed values to appsettings.json? Composer keeps separate track of some settings (app password for example) for security reasons. To make sure it runs outside of Composer you have to ensure that all needed settings are there. Additionally; if you open a bot in Composer it will remove/overwrite-with-empty those settings that it keeps track of.

taoofstefan commented 2 years ago

@dmvtech This is what I get from the App Service Editor:

[info] Click on http://botlow.azurewebsites.net to open your site 2022-05-24 18:06:15.599 +00:00 [Information] Microsoft.AspNetCore.Hosting.Diagnostics: Request starting HTTP/1.1 POST http://botlow.azurewebsites.net/api/messages application/json; charset=utf-8 591 2022-05-24 18:06:15.600 +00:00 [Information] Microsoft.AspNetCore.Routing.EndpointMiddleware: Executing endpoint 'BigBen.Controllers.BotController.PostAsync (BigBen)' 2022-05-24 18:06:15.600 +00:00 [Information] Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker: Route matched with {action = "Post", controller = "Bot"}. Executing controller action with signature System.Threading.Tasks.Task PostAsync(System.String) on controller BigBen.Controllers.BotController (BigBen). 2022-05-24 18:06:15.608 +00:00 [Information] Microsoft.Bot.Builder.Dialogs.Adaptive.Runtime.CoreBotAdapter: ProcessActivityAsync 2022-05-24 18:06:15.611 +00:00 [Information] Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker: Executed action BigBen.Controllers.BotController.PostAsync (BigBen) in 10.3151ms 2022-05-24 18:06:15.611 +00:00 [Information] Microsoft.AspNetCore.Routing.EndpointMiddleware: Executed endpoint 'BigBen.Controllers.BotController.PostAsync (BigBen)' 2022-05-24 18:06:15.611 +00:00 [Information] Microsoft.AspNetCore.Hosting.Diagnostics: Request finished in 11.7945ms 401

Does that mean it's an error 401?

Are you copying all the needed values to appsettings.json? Composer keeps separate track of some settings (app password for example) for security reasons. To make sure it runs outside of Composer you have to ensure that all needed settings are there. Additionally; if you open a bot in Composer it will remove/overwrite-with-empty those settings that it keeps track of.

Probably not, as I don't fully understand all of this yet.

I only changed the LUIS block, but for the rest I am honestly very lost. I don't even know where to begin. I guess the two "configuration" blocks are wrong.

Is there a template you can provide me with? I looked but didn't find anything. The Composer definitely makes it look different than coding it from scratch.

This is how my appsettings.json looks like (shortened all the keys):

`{ "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": "westeurope", "defaultLanguage": "en-us", "endpoint": "https://westeurope.api.cognitive.microsoft.com/", "endpointKey": "56........6", "authoringKey": "", "environment": "composer", "name": "BigBen" }, "MicrosoftAppId": "", "publishTargets": [ { "name": "Botflow", "type": "azurePublish", "configuration": "{\"name\":\"BigBen\",\"environment\":\"dev\",\"tenantId\":\"f4 ...... e8dfb2190cab\",\"hostname\":\"\",\"runtimeIdentifier\":\"win-x64\",\"resourceGroup\":\"botflow\",\"botName\":\"BigBen\",\"subscriptionId\":\"90.......992c30341f8a\",\"region\":\"global\",\"appServiceOperatingSystem\":\"windows\",\"scmHostDomain\":\"\",\"luisResource\":\"BigBen(composer)-BigBen.en-us.lu\",\"settings\":{\"applicationInsights\":{\"InstrumentationKey\":\"\",\"connectionString\":\"\"},\"cosmosDb\":{\"cosmosDBEndpoint\":\"\",\"authKey\":\"\",\"databaseId\":\"botstate-db\",\"containerId\":\"botstate-container\"},\"blobStorage\":{\"connectionString\":\"\",\"container\":\"\"},\"luis\":{\"authoringKey\":\"fd......0\",\"authoringEndpoint\":\"https://westeurope.api.cognitive.microsoft.com/\",\"endpointKey\":\"\",\"endpoint\":\"\",\"region\":\"westeurope\"},\"qna\":{\"subscriptionKey\":\"\",\"endpoint\":\"\"},\"MicrosoftAppId\":\"\",\"MicrosoftAppPassword\":\"\"},\"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\":\"5.......6\",\"authoringRegion\":\"westeurope\",\"defaultLanguage\":\"en-us\",\"endpoint\":\"\",\"environment\":\"composer\",\"name\":\"BigBen\"},\"MicrosoftAppId\":\"07........11\",\"publishTargets\":[],\"qna\":{\"hostname\":\"\",\"knowledgebaseid\":\"\",\"qnaRegion\":\"westus\"},\"runtime\":{\"command\":\"dotnet run --project BigBen.csproj\",\"customRuntime\":true,\"key\":\"adaptive-runtime-dotnet-webapp\",\"path\":\"../\"},\"runtimeSettings\":{\"adapters\":[],\"features\":{\"removeRecipientMentions\":false,\"showTyping\":true,\"traceTranscript\":false,\"useInspection\":false,\"setSpeak\":{\"voiceFontName\":\"en-US-JennyNeural\",\"fallbackToTextForSpeechIfEmpty\":true}},\"components\":[{\"name\":\"Microsoft.Bot.Components.AdaptiveCards\",\"settingsPrefix\":\"Microsoft.Bot.Components.AdaptiveCards\"}],\"skills\":{\"allowedCallers\":[]},\"storage\":\"\",\"telemetry\":{\"logActivities\":true,\"logPersonalInformation\":false,\"options\":{\"connectionString\":\"\"}}},\"skillConfiguration\":{},\"skillHostEndpoint\":\"http://localhost:3980/api/skills\"}", "lastPublished": "2022-05-22T16:20:26.610Z" }

], "qna": { "hostname": "", "knowledgebaseid": "", "qnaRegion": "westus" }, "runtime": { "command": "dotnet run --project BigBen.csproj", "customRuntime": true, "key": "adaptive-runtime-dotnet-webapp", "path": "../" }, "runtimeSettings": { "adapters": [], "features": { "removeRecipientMentions": false, "showTyping": true, "traceTranscript": false, "useInspection": false, "setSpeak": { "voiceFontName": "en-US-JennyNeural", "fallbackToTextForSpeechIfEmpty": true } }, "components": [ { "name": "Microsoft.Bot.Components.AdaptiveCards", "settingsPrefix": "Microsoft.Bot.Components.AdaptiveCards" } ], "skills": { "allowedCallers": [] }, "storage": "", "telemetry": { "logActivities": true, "logPersonalInformation": false, "options": { "connectionString": "" } } }, "skillConfiguration": {}, "skillHostEndpoint": "http://localhost:3980/api/skills" }`

In terms of password, I got this message in VS that the Azure Key Vault was missing and I linked to the bot secrets from the corresponding resources group.

There's obviously something wrong with the configuration. Can you help me?

dmvtech commented 2 years ago

Hi @taoofstefan

Please recreate the error while running Composer with debugging options. Here are the steps:

Once you get the error, please send the entirety of the output in the terminal.

dmvtech commented 2 years ago

Closing due to lack of response. If you are still experiencing this issue, please supply the requested logs and we will reopen to continue.

trmave commented 2 years ago

Hola! este error se resuelve creando un perfil de despliegue en otra maquina, con un bot composer recien instalado . El error esta localizado en el archivo de configuracion APPSETTING.JSON en la linea de "publishTargets" ,copien y peguen con la configuracion creada de cero y podran resolverlo , logico que es entender que es lo que va ir ,pero si es el caso como el mio que simplemente borre el perfil por crear otro y comenzo salir el error 401 . esto soluciono mi problema no tiene nada que ver con los roles si eres Dueño de tu suscripcion lo de los roles es valido si solo si ya estas publicando en produccion !. XoXo amigos. PERO luego les va salir un error de ENOTFOUND si es que el bot no estaba muy homologado.

Hello! This error is resolved by creating a usage profile on another machine, with a newly installed bot composer. The error is located in the APPSETTING.JSON configuration file in the "publishTargets" line, copy and paste with the configuration created from scratch and you will be able to solve it, it is logical to understand what is going to happen, but if it is the case how mine simply deleted the profile to create another one and the 401 error began to appear. This solved my problem. It has nothing to do with the roles, if you are the Owner of your subscription, the roles are valid only if you are already publishing in production! XoXoXo friends.BUT then they will get an ENOTFOUND error if the bot was not very approved.

pablodiloreto commented 2 years ago

Hello team! The context that start this issue is that you are working with a personal account into a default directory in your Azure Subscription. To resolve it, you do not need to create ANY resource in manual mode: you need to create a user in your Azure AD Directory (for example user1@xxxxxxxx.onmicrosoft.com) and give to this user a permission to create and register applications in your Azure AD Directory (for example Global Admin, Contributor, etc).

After that, you need to give to the same created user permissions to the Azure subscription (or resource group) where you will deploy your bot from Bot Framework Composer (for example Owner).

Lastly, you need to login to your Bot Framework Composer with this new user, and there the error will be gone.

I repeat: it is not an application error, it is an error because you are working with a personal user and not a business user. Working with a business, in this case, has no cost.