visual-studio-codeazure-api-managementapim

Getting a 404 error when I try to debug a policy using Azure APIM management extension in Visual Studio Code


I am trying to debug an APIM policy using the Azure APIM Management extension in visual studio code.

The request is a POST and I am able to use the TEST option successfully. However, when I try to debug it throws an error in the console immediately as follows:

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}


Solution

  • Initially, I was also getting the same gateway error while debugging the APIM policies locally in vs code. To resolve this error, you need to enable tracing in the Subscription level as shown below.

    enter image description here

    This setting will help you to debug the policies locally as it will add the subscription key in Ocp-Apim-Debug.

    enter image description here