Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Policy debugging always fail with 401 error #364

Open
KijoKim76 opened this issue Sep 20, 2024 · 4 comments
Open

Policy debugging always fail with 401 error #364

KijoKim76 opened this issue Sep 20, 2024 · 4 comments

Comments

@KijoKim76
Copy link

Any insight?

Error logs:

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","supportsProgressReporting":true,"supportsInvalidatedEvent":true,"supportsMemoryReferences":true,"supportsArgsCanBeInterpretedByShell":true,"supportsMemoryEvent":true,"supportsStartDebuggingRequest":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://aipm-epso-authtest01.azure-api.net/debug-0123456789abcdef","managementAddress":"https://management.azure.com//subscriptions/e0ba1ef1-afb6-4f98-9d74-a71e310bae84/resourceGroups/epso-apimauth-test-rg/providers/microsoft.apimanagement/service/aipm-epso-authtest01","subscriptionId":"e0ba1ef1-afb6-4f98-9d74-a71e310bae84","operationData":"GET https://aipm-epso-authtest01.azure-api.net/demo/topics HTTP/1.1\nOcp-Apim-Subscription-Key: xxxxxx\nOcp-Apim-Debug: xxxxxx\nOcp-Apim-Trace: true\n","fileName":"aipm-epso-authtest01-demo-conference-api-GetTopics.http","__sessionId":"206d4c9a-0b26-4464-a081-a09851634617"})
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}

@quinterojose
Copy link

I am running in this same issue. Any updates?

@san360
Copy link

san360 commented Jan 31, 2025

Can't connect to gateway: Unexpected server response: 404.

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","supportsProgressReporting":true,"supportsInvalidatedEvent":true,"supportsMemoryReferences":true,"supportsArgsCanBeInterpretedByShell":true,"supportsMemoryEvent":true,"supportsStartDebuggingRequest":true,"supportsANSIStyling":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://san360-apim-oai-2whc3o65z7au6.azure-api.net/debug-xxxxxxxxx","managementAddress":"https://management.azure.com//subscriptions/1da52b57-xxxx-xxxx-xxxx-1255cc1f6e8e/resourceGroups/shared-services/providers/microsoft.apimanagement/service/san360-apim-oai-2whc3o65z7au6","subscriptionId":"1da52b57-468a-xx-xxxx-xxxxxxx","operationData":"GET https://san360-apim-oai-2whc3o65z7au6.azure-api.net/objects/objects HTTP/1.1\nOcp-Apim-Subscription-Key: xxxxxxxxxxxxxxxxxxxx\nOcp-Apim-Debug: xxxxxxxxxxxxx\nOcp-Apim-Trace: true\n","fileName":"san360-apim-oai-2whc3o65z7au6-demo-api-get-objects.http","__sessionId":"c6e07900-f5e3-4603-a31d-b31e49f3104c"})
To client: {"seq":0,"type":"event","event":"output","body":{"category":"stderr","output":"Can't connect to gateway: Unexpected server response: 404."}}
Can't connect to gateway: Unexpected server response: 404.
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}

@blackchoey
Copy link
Collaborator

The 401 error is because your Subscription Key does not allow tracing. Please go to Azure Portal and allow tracing for your Subscription Key before debug policies. We're working on a feature to allow tracing automatically for you. Please stay tuned.

Image

@quinterojose
Copy link

The 401 error is because your Subscription Key does not allow tracing. Please go to Azure Portal and allow tracing for your Subscription Key before debug policies. We're working on a feature to allow tracing automatically for you. Please stay tuned.

Image

I can confirm this fixes it. Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants