OfficeDev / microsoft-teams-tunnelrelay

Tunnel relay allows you to expose local services to the outside world over HTTPS
MIT License
81 stars 18 forks source link

Teams Message Extension BOT - Response not getting back to caller #43

Open llowevad opened 2 years ago

llowevad commented 2 years ago

I have a teams message extension (node.js / javascript / vscode) i am working on and hooked up the relay and setup tunnel relay. I configured my site endpoints and domains to point to my relay hybrid connection listener and i can see the requests coming into tunnel relay and also see the response sent by tunnel relay (or at least sent to tunnel relay from my host). Even though that response is valid it is not getting back to my application in teams and it fails stating it is unable to reach the app.

I am using Tunnel Relay on Windows installed via the MSI downloaded from v2.2 from May 13, 2020.

Is this a known issue or is there a configuration i am missing?

RamjotSingh commented 2 years ago

Taking a guess here. Generally nodeJS (and other such systems) expect things to be at root level (which isn't true with Tunnel Relay) so after the first request, subsequent requests get made to root and thus end up failing. Please check this in network tab of your browser or something other similar tracer.

llowevad commented 2 years ago

The title of this project is "teams-tunnelrelay", if you need to create a workaround to get it to work, then it really isn't an option for teams. Creating an azure relay and working with Tunnel relay on the dev server is very simple and pretty slick, however I would not be able to convince my customer to configure front door with all the added expense because node.js only likes dealing with root level endpoints.

Are there any plans on updating tunnel relay to support handling this routing?

Is there a way to manipulate this through a plugin post processing?

RamjotSingh commented 2 years ago

NodeJS I believe can be reconfigured to stop assuming resources are at root (not an expert in nodeJS but ~/ can be changed). So that would be the way out.

llowevad commented 2 years ago

I looked up node.js configurations and I think you are referring to the document root / application root properties, however this seems to affect the application which is loaded by my localhost.

The request comes into servicebus.windows.net/machine and gets routed through the tunnel relay to localhost:3978 where the code is executed. This seems to happen just fine as Tunnel Relay is showing me the response with data payload (I can also walk through debugging it as well). The issue is this response is sent from localhost:3978 back to the caller, it doesn't seem to be getting back to teams. I am not even sure it is getting back to servicebus.windows.net/machine as fiddler and IE dev tools are not showing me anything other than the invoke failed.

I am not sure how node.js attempting to load resources from the root would be affecting this as the node.js application already executed the code and returned a response. It seems like the response has no where to go.

stevebeauge commented 1 year ago

Did you manage to get a working solution ?