Can't open new tab with same endpoint URL by clicking the endpoint
See original GitHub issueVersion
4.4.1
Describe the bug
I have a bot file that I want to use for any local bot running on port 3978:
{
"name": "3978",
"description": "",
"services": [
{
"type": "endpoint",
"appId": "",
"appPassword": "",
"endpoint": "http://localhost:3978/api/messages",
"id": "1",
"name": "Unauthenticated"
},
{
"type": "endpoint",
"appId": "<GUID>",
"appPassword": "<password>",
"endpoint": "http://localhost:3978/api/messages",
"id": "2",
"name": "GitHubProfileBot"
}
],
"padlock": "",
"version": "2.0",
"path": "C:\\Dev\\3978.bot",
"overrides": null
}
This shows up just fine in the bot explorer panel, and I can open up both endpoints simultaneously by clicking “Open in Emulator” in the context menu:
However, you are supposed to be able to open an endpoint by just clicking on it in the endpoint list. This doesn’t work if the endpoint has the same URL as an endpoint that’s already open. It seems like the behavior for clicking an endpoint from the list involves checking the endpoint URL to see if it matches any of the open tabs, and then switching to that tab if one is found. It doesn’t realize that the tab it’s switching to is not the same endpoint as the one I clicked.
To Reproduce
Steps to reproduce the behavior:
- Give two endpoints the same URL in a bot file
- Open the bot file in the Emulator
- With one endpoint already open, click the other endpoint in the endpoint list in the bot explorer panel
- Notice that the endpoint isn’t opened in a new tab
Expected behavior
The Emulator should recognize an endpoint by its ID (or perhaps the combination of all its properties) instead of its URL, and it should open an endpoint when you click on it even if another endpoint with the same URL is already open. While it may seem like this isn’t useful because you can’t run multiple bots on the same port, the Emulator does allow you to open multiple tabs with the same URL through the context menu, and that indicates that this bug is not by design.
[bug]
Issue Analytics
- State:
- Created 4 years ago
- Comments:10 (7 by maintainers)
Top GitHub Comments
I can confirm that 2 endpoints within the same botfile with the same
endpoint
value will repro this.This issue is a bot more complex and warrants discussion. The schema for the IConnectedService shows the
id
field as optional and no enforcement is made to ensure unique ids for services within a botfile. This fact lead the Emulator to register endpoints via theendpoint
field which works for deployed bots but breaks for local bots given @v-kydela 's use case.The question is then: “how do we guarantee a unique identifier for services within a botfile?”
id
field as required, read only and unique. Then validate this on all botfiles being opened in the Emulator. This affords us to register the endpoints byid
instead of by theendpoint
field since we can now rely on the ids being unique.I am for solving #990 since it would address the side-effects of not being able to rely on unique ids.
During standup last week, we decided that the root cause of the issue should be fixed, which is that the bot file –
msbot
– needs to generate a stable, unique id for endpoint services so that they can be reliably differentiated between by the Emulator.