microsoft / vscode-apimanagement

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

Policy debugging fails with 401 #272

Open szszoke opened 1 year ago

szszoke commented 1 year ago

Hello,

Yesterday I created a completely new APIM instance, today I am trying to debug an operation on the Echo API that was there by default after the instance was deployed.

When I try to do that, I get the following messages in the debug console:

From client: initialize({"clientID":"vscode","clientName":"Visual Studio Code","adapterID":"apim-policy","pathFormat":"path","linesStartAt1":true,"columnsStartAt1":true,"supportsVariableType":true,"supportsVariablePaging":true,"supportsRunInTerminalRequest":true,"locale":"en-us","supportsProgressReporting":true,"supportsInvalidatedEvent":true,"supportsMemoryReferences":true,"supportsArgsCanBeInterpretedByShell":true})
To client: {"seq":0,"type":"response","request_seq":1,"command":"initialize","success":true,"body":{"supportsConfigurationDoneRequest":true,"supportsRestartRequest":false,"supportsRestartFrame":false}}
From client: launch({"type":"apim-policy","request":"launch","name":"Attach to APIM","stopOnEntry":true,"gatewayAddress":"wss://szabi-apim-test.azure-api.net/debug-0123456789abcdef","managementAddress":"https://management.azure.com//subscriptions/XXX/resourceGroups/szabi-apim/providers/microsoft.apimanagement/service/szabi-apim-test","subscriptionId":"XXX","operationData":"GET https://szabi-apim-test.azure-api.net/echo/szabi/api/cj/cv/v1/{*endpoint} HTTP/1.1\nOcp-Apim-Subscription-Key: RRR\nOcp-Apim-Debug: RRR\nOcp-Apim-Trace: true\n","fileName":"szabi-apim-test-echo-api-proxy.http","__sessionId":"YYY"})
To client: {"seq":0,"type":"event","event":"output","body":{"category":"stderr","output":"Can't connect to gateway: Unexpected server response: 401."}}
Can't connect to gateway: Unexpected server response: 401.
To client: {"seq":0,"type":"event","event":"terminated"}
From client: disconnect({"restart":false})
To client: {"seq":0,"type":"response","request_seq":3,"command":"disconnect","success":true}

Debugging eventually fails with the Can't connect to gateway: Unexpected server response: 401. message.

szszoke commented 1 year ago

Update: I enabled tracing and that seem to have resolved it.