Closed sussexrick closed 4 years ago
OK, I worked this out. One of the requests, probably the Swagger one, was being blocked by IP restrictions on the web app set in the Azure portal under [web app] > Networking > Access restrictions.
I'll leave the issue open in case you can improve the documentation. It would be helpful if:
For anyone finding this, the IPs used by Azure DevOps agents are listed at https://docs.microsoft.com/en-us/azure/devops/pipelines/agents/hosted?view=azure-devops&tabs=yaml#agent-ip-ranges
However, I ended up running my API in a Docker container within the pipeline, downloading swagger.json from there, and specifying it as a file rather than using the URL on the Web App, avoiding the need to pass the IP restrictions.
I also discovered that the same error can be triggered by the request to the API Management API which occurs before the Swagger request. This happened when using a self-hosted build agent, but we didn't try to solve it.
I'm seeing the same issue as closed issue #58.
This is running on Azure DevOps (online, not Server) with the following task configuration:
The task output is as follows:
Looking at the task code at https://github.com/stephaneey/azure-apim-extension/blob/master/apimversioned/v4/apimversioned.ps1 I can see it's outputting the message on line 143 but not the one on 147. It's not calling a method between those, so it's probably throwing a
WebException
, and my guess is it's a 404 because otherwise it would hit thethrow
on line 157. It would go on to attempt the Swagger definition download and if that failed it would throw this error on line 187,$swagger=$swagger.Replace("
rn","
n")`.As you can tell there's a lot of guesswork in that analysis though, and I wonder whether there's a better way I can debug it?
I get the same output for an API that I know exists as for one that doesn't. If the original error is indeed the
WebException
, perhaps I'm specifying the{api-name-here}
incorrectly? I'm using the value you see in the Azure Portal if you click on an API and go to Settings > Name?