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

The wrong dev tunnel is being selected #11844

Open
wss-alubic opened this issue Jun 17, 2024 · 4 comments
Open

The wrong dev tunnel is being selected #11844

wss-alubic opened this issue Jun 17, 2024 · 4 comments
Assignees
Labels

Comments

@wss-alubic
Copy link

Describe the bug

I'm using Visual Studio 2022 17.10
I have a solution that contains a .NET 8.0 API called MyProject.API
I used the Microsoft Teams app template to add a Command Bot called MyProject.ChatBot

When following the steps in TeamsApp/GettingStarted.md, it asks me to create a Dev Tunnel. When I do, it creates dev tunnels for the API project and the ChatBot project.

When I run "Prepare Teams App dependencies", it's using the DevTunnel for MyProject.API instead of MyProject.ChatBot. The .env.local file has the wrong dev tunnel on BOT_ENDPOINT. If I change this file, validation fails.

To Reproduce

  1. Create a new solution with a .NET 8.0 API in it. Name the project "MyProject.API"
  2. Add a Command Bot project to the solution. The name must alphabetically come after the API Project, so name it "MyProject.ChatBot"
  3. Follow the steps in TeamsApp/GettingStarted.md
  4. Notice that TeamsApp/env/.env.local has the wrong BOT_ENDPOINT value. It should be the dev tunnel for MyProject.ChatBot, but instead its pointing to MyProject.API.

Expected behavior
The Teams Toolkit -> Prepare Teams App Dependencies UI option should pick the dev tunnel for the ChatBot instead of assuming the first dev tunnel in the list is the correct one for BOT_ENDPOINT.

Screenshots
N/A

VS Code Extension Information (please complete the following information):
I am not using the VS Code extension. I'm using VS 2022 17.10

CLI Information (please complete the following information):
Not using the CLI, I'm using VS 2022 17.10

Additional context
I have a workaround but it's less than ideal. If I temporarily remove MyProject.API from the solution, everything works and it selects the ChatBot project's dev tunnel.

I do not know if this matters, but I also have a Blazor app called MyProject.Web and a .NET 8.0 console app called MyProject.Notifications inside the solution. These do not get dev tunnels so they should be fine.

@microsoft-github-policy-service microsoft-github-policy-service bot added the needs attention This issue needs the attention of a contributor. label Jun 17, 2024
@adashen adashen added investigating TA:Infra Team Area: Infra labels Jun 18, 2024
@xiaolang124 xiaolang124 removed the needs attention This issue needs the attention of a contributor. label Jun 19, 2024
@xiaolang124
Copy link
Contributor

Hi, can you check if VS supports using different dev tunnels for debugging? I have tried this in my local environment and found that I can only use the same dev tunnel in multiple projects. If I change the dev tunnel in one project, it changes for the others as well.

image
image

@wss-alubic
Copy link
Author

wss-alubic commented Jun 19, 2024

@xiaolang124 Sorry, I should have been more clear. The issue isn't the wrong devtunnel being picked. It's that the wrong port for the wrong project is being created.

image

  1. I set the startup project as TtkDevTunnelBug.ChatBot
  2. I create a public persistent devtunnel, it has 0 ports
  3. I run "Prepare Teams App Dependencies". The DevTunnel now has 1 port, but it's to the API instead of the ChatBot.
  4. This incorrect devtunnel URL is written to .env.local

Here's a minimal reproduction repo. All I did was add an ASP.NET API, Blazor WebAssembly app, and the Teams Chat Command Bot. I made sure the API's name was alphabetically sorted above the Bot.

https://github.com/wss-alubic/ttk-devtunnel-bug/tree/main

@microsoft-github-policy-service microsoft-github-policy-service bot added the needs attention This issue needs the attention of a contributor. label Jun 19, 2024
@xiaolang124 xiaolang124 removed the needs attention This issue needs the attention of a contributor. label Jun 21, 2024
@xiaolang124
Copy link
Contributor

Thanks for sharing the steps to reproduce the issue. I can reproduce the bug. We will investigate this further.

@xiaolang124
Copy link
Contributor

There is another workaround. You can update your BOT_ENDPOINT and BOT_DOMAIN in 'env.local' to the correct values and select "None" for the dev tunnel when preparing the Teams app. Then you can select the dev tunnel and continue to debug.

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

No branches or pull requests

3 participants