Azure / apiops

APIOps applies the concepts of GitOps and DevOps to API deployment. By using practices from these two methodologies, APIOps can enable everyone involved in the lifecycle of API design, development, and deployment with self-service and automated tools to ensure the quality of the specifications and APIs that they’re building.
https://azure.github.io/apiops
MIT License
327 stars 192 forks source link

[BUG] Strange circular reference #308

Closed dannythomas13 closed 1 year ago

dannythomas13 commented 1 year ago

Release version

v4.1.0

Describe the bug

I have today noticed a strange bug whereby upon completion of the Creator pipeline the Web service URL of all API's are changed to be that of APIM itself - this means that if I submit a call to APIM then I get a circular reference and thousands of calls are made

Expected behavior

Backend API URL is set correctly

Actual behavior

Without any obvious change within the pull request it appears the backend URL is being adjusted

Reproduction Steps

Import API into APIM dev Run extractor followed by Creator Observe that Web Service URL within settings of API is changed

waelkdouh commented 1 year ago

By creator I assume you mean the publisher?

waelkdouh commented 1 year ago

This is not a known issue. It’s not easy for us to reproduce on our side. Can you try against a different instance or start from scratch?

waelkdouh commented 1 year ago

Just a quick clarification. What type of services are you extracting? WSDL,Openapi,etc.?

dannythomas13 commented 1 year ago

Yes it is indeed the publisher step and I am extracting via OpenAPI v3 json - is there anything I can check on my side, maybe if you point me in the direction of what sets/overwrites the value of the backend service?

waelkdouh commented 1 year ago

Thanks for the clarification. I checked internally and it seems to be a known issue. It has been raised in another existing issue which we will link here shortly. Someone will respond to this post shortly, so please keep an eye.

anotherRedbeard commented 1 year ago

Hi @dannythomas13, is your specification.yaml file in the commit without the apiinformation.json file being in the commit with it? If so, that might be the same as this issue https://github.com/Azure/apiops/issues/275.

dannythomas13 commented 1 year ago

Hi @dannythomas13, is your specification.yaml file in the commit without the apiinformation.json file being in the commit with it? If so, that might be the same as this issue #275.

Yes it is! What I did was a re-import but effectively all it did was add a single Operation as everything else that was imported was already there

dannythomas13 commented 1 year ago

Hi @dannythomas13, is your specification.yaml file in the commit without the apiinformation.json file being in the commit with it? If so, that might be the same as this issue #275.

Yes it is! What I did was a re-import but effectively all it did was add a single Operation as everything else that was imported was already there

I have just checked your link, it is indeed a duplicate (my search skills let me down sorry)

anotherRedbeard commented 1 year ago

No worries on the dup, but I will mark this as a duplicate and point to the other open issue #275 . A workaround for now would be to make sure you add the apiinformation.json file to each commit when you change the specification.yaml file and then it will update correctly.

There is a PR out there for a fix, but ultimately the issue is on the APIM side of things. You get the same experience if you call in to the APIM api. When you issue this request: PUT https://management.azure.com/subscriptions/%7BsubscriptionId%7D/resourceGroups/%7BresourceGroupName%7D/providers/Microsoft.ApiManagement/service/%7BserviceName%7D/apis/%7BapiId%7D?api-version=2022-08-01 using the "format":"Openapi" and set the value to the Open API spec it overwrites the ServiceUrl in the API with the URL for the APIM instance.

Here is the PR I created if you are curious as to what I suggested as a fix: https://github.com/Azure/apiops/pull/280