microsoft / vscode-apimanagement

VS Code extension for Azure API Management.
MIT License
60 stars 40 forks source link

Policy debugging doesn't work when using hostname for self-hosted gateway #217

Open thepolyglotter opened 3 years ago

thepolyglotter commented 3 years ago

APIM Setup:

Problem statement:

When trying to debug policy from VS Code for APIs on self-hosted gateway, the bugging operation fails with 404 error which test of same API from VS code works fine.

Steps to reproduce problem:

  1. Right-click on API Management instance and choose "Select Gateway Host Name"

  2. A text field is activated at the top of VS Code with 2 choices in dropdown. Choose "Input a hostname (for self-hosted gateway)" image

  3. Enter the hostname "gc-api-dev-apimgwt.apps.xxxxxxxx.xxxxxxx.com" and press enter image

  4. Test operation on selected API --> Correct hostname is used. image

  5. Hit "Send Request" and response is 200 OK. image

  6. Right click on an operation of selected API and choose "Start Policy Debugging". Debugging tries to initialize and then stops. Nothing happens

Debug Console shows 404 error: image

Version: 1.56.2 (user setup) Commit: 054a9295330880ed74ceaedda236253b4f39a335 Date: 2021-05-12T17:13:13.157Z Electron: 12.0.4 Chrome: 89.0.4389.114 Node.js: 14.16.0 V8: 8.9.255.24-electron.0 OS: Windows_NT x64 10.0.19042

jan-jonas-ruv commented 1 year ago

@thepolyglotter: We are facing a similar issue. Have you checked the logs on the self-hosted gateway?

If we try to connect a debugger , we see the following error on the gateway side:

[Info] XXXXXXXXXXXXXX, isRequestSuccess: False, totalTime: 0, category: GatewayLogs, callerIpAddress: XXXXXXXX, timeGenerated: XXXXXXXX, region: XXXXXXX, correlationId: XXXXXXXXXXXXXXXXX, method: GET, url: https://XXXXXXXXXXXX/debug-0123456789abcdef?key=XXXXXXXXXXXXXXXXXXXX, responseCode: 404, responseSize: 130, cache: none, clientProtocol: HTTP/1.0, clientTlsVersion: 1.2, lastError: { "source": "configuration", "reason": "OperationNotFound", "message": "Unable to match incoming request to an operation.", "section": "backend" }, correlationId: XXXXXXXXXXXXXXXX

Does anyone know what network connectivity is needed between the client (VS Code) and the server (self-hosted gateway)? Maybe a web-socket connection is required and this is blocked by a firewall sitting between VS Code and the gateway. I haven't checked this in detail in our infrastructure.