microsoft / Broadcast-Development-Kit

Tools for Broadcasters utilizing Teams
MIT License
58 stars 24 forks source link

Local setup error and behavior #33

Open ervingayle opened 3 years ago

ervingayle commented 3 years ago

Hello Team,

I am trying to get the sample functional in my local environment prior to testing this in Azure. My local environment is Windows 11 insider preview, Visual Studio 2019 and the required pre-requisites that are detailed for a successful install. So far I have tried running the sample using the provided instructions where we make a POST with the meeting url and receive a response. However once this is done, the steps in the "use of management api" starting with initiate-call while it returns a result generates an error: "[20:28:52 INF] Connection id "0HMBKN90LJ54A" bad request data: "Invalid request line: '\x16\x03\x01\x01\x00\x01\x00\x00\"

From my experience this is caused when you try to access a http endpoint via https. I have revisited all of the steps multiple times and do not see where this would be the case. Is there any guidance that you can provide? Thank you in advance for your time.

JonatanMedinilla commented 3 years ago

Hi @ervingayle, I cannot provide you any guidance without details or context. As you said, that issue occurs when trying to access an HTTP endpoint via HTTPS. I guess that the issue you mentioned, is being displayed in the BotService console, Am I right? Without context, the only thing that I can say is that it probably is an issue in the BotService configuration or in the service registry in Cosmos DB. If you can provide us more context like the configuration settings (appSettings.local.json, launchSettings.json - without the secrets) and the service registry in Cosmos DB, it would be helpful to troubleshoot the issue and give you guidance.

FYI, I deconfigured my local environment to reproduce the issue. By default, the BotService uses 9442 for HTTPS and 9441 for HTTP. When the Management API sends a request to the bot, it queries for the service assigned to the current call, get the DNS field, sets the BotServiceClient base URL, and uses the BotServiceClient to send requests to the BotService API (it always uses HTTPS). So when we add the service registry to Cosmos DB, we add as DNS the URL with the HTTPS port (without the https://), e.g.: "localhost:9442".

Example of service registry image

Example of BotServiceClient InviteBotAsync method image

I've modified the appSettings.local.json of the BotService and switched the ports; now kestrel configures 9441 for HTTPS and 9442 for HTTP.

Example of appSettings.local.json image

So, when the BotServiceClient sends a request tp https://localhost:9442/api/bot/invite (the one we specified in the service registry), it tries to access an HTTP endpoint via HTTPS and it fails, showing a similar error to the one that you shared.

image

beteta93 commented 3 years ago

I am having the same problem you have mentioned, How could I solve it?