microsoft / dev-tunnels

Dev Tunnels SDK
MIT License
286 stars 20 forks source link

Tunnel service returned status code: 403 Forbidden #436

Closed XiaofuHuang closed 4 months ago

XiaofuHuang commented 5 months ago

Copied bug from: https://github.com/OfficeDev/TeamsFx/issues/11275 Problem When attempting to create a dev tunnel using both the Dev tunnel JS SDK and CLI, user consistently encounter a 403 Forbidden error.

Details from original post: I am unable to run the debug operation in Teams toolkit. I have create a testing account for running debug code. The account has custom app upload capability. But im getting this error constantly. It has only started recently, I had tried the same a month back and it was working fine.

Summary:

(×) Error: Unable to execute dev tunnel operation 'create'. Tunnel service returned status code: 403 Forbidden

Visit https://aka.ms/teamsfx-local-tunnel-task to learn more about 'Start local tunnel' task.

[2024-04-03T06:38:17.984Z] [Error] - code:Ext.DevTunnelOperationError, message: Unable to execute dev tunnel operation 'create'. Tunnel service returned status code: 403 Forbidden Help link: https://aka.ms/teamsfx-local-tunnel-task

Updates Yes, the issue is happenning even after using the dev tunnel. Still getting the same error message. image

derekbekoe commented 5 months ago

Do you have a request id / tunnel id with a timestamp of the request? Running the CLI with --verbose should help with getting this information.

ashlytom commented 5 months ago

@derekbekoe I have the tunnel id. But there is no timestamp. These are the results from the verbose statement. Please let me know if more data is needed.

HTTP: GET https://global.rel.tunnels.api.visualstudio.com/userlimits?api-version=2023-09-27-preview HTTP: Authorization: Bearer HTTP: User-Agent: Dev-Tunnels-Service-CLI/1.0.1249+67b1cd300c HTTP: User-Agent: (OS:Microsoft Windows 10.0.19045) HTTP: User-Agent: Dev-Tunnels-Service-CSharp-SDK/1.1.29+db5d357e46 HTTP: PUT https://global.rel.tunnels.api.visualstudio.com/tunnels/tidy-fog-26xc4x3?includePorts=true&tokenScopes=host,connect&api-version=2023-09-27-preview HTTP: Authorization: Bearer HTTP: If-None-Match: HTTP: User-Agent: Dev-Tunnels-Service-CLI/1.0.1249+67b1cd300c HTTP: User-Agent: (OS:Microsoft Windows 10.0.19045) HTTP: User-Agent: Dev-Tunnels-Service-CSharp-SDK/1.1.29+db5d357e46 HTTP: { "tunnelId": "tidy-fog-26xc4x3", "accessControl": { "entries": [ { "type": "Anonymous", "subjects": [], "scopes": [ "connect" ] } ] }, "ports": [ { "portNumber": 3978, "protocol": "http", "options": {}, "sshUser": "", "portForwardingUris": null, "inspectionUri": null } ] } HTTP: 403 Forbidden (307 ms) HTTP: Server: Zscaler/6.2 HTTP: Cache-Control: no-cache HTTP: Access-Control-Allow-Origin: HTTP: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3c.org/TR/1999/REC-html401-19991224/loose.dtd">

derekbekoe commented 5 months ago

The error is not being returned by the Dev Tunnels service. It appears the 403 error is coming from a proxy, Zscaler. Please check with your network admins.

ashlytom commented 4 months ago

Thank you. It was an issue caused due to the firewall on the system i was working with. Once the API within devtunnel host was whitelisted, it started working again. You can close this issue.