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}
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.
This setting will help you to debug the policies locally as it will add the subscription key in Ocp-Apim-Debug.