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

[BUG] Publishing APIs fails with errors 409 PessimisticConcurrencyConflict or 422 ManagementApiRequestFailed #497

Closed
mgrabarz opened this issue Feb 29, 2024 · 23 comments

Comments

@mgrabarz
Copy link

Release version

APIOPS v5.0.0

Describe the bug

Publishing process fails on the random API (all objects before are deployed fine) with one of two errors:

  • System.Net.Http.HttpRequestException: HTTP request to URI https://management.azure.com/subscriptions/sub/resourceGroups/apim-name/providers/Microsoft.ApiManagement/service/apim-name/apis/api-name?api-version=2022-04-01-preview failed with status code 422. Content is '{"error":{"code":"ManagementApiRequestFailed","message":"Failed to connect to management endpoint apim-name.management.azure-api.net:3443 for a service deployed in a Virtual Network. Make sure to follow guidance at https://aka.ms/apim-vnet-common-issues for Inbound connectivity to Management endpoint. Check 'ApiManagement Control Plane - inbound' connectivity at https://aka.ms/apimnetworkstatus.","details":null,"innerError":null}}'.
  • System.Net.Http.HttpRequestException: HTTP request to URI https://management.azure.com/subscriptions/sub/resourceGroups/apim-name/providers/Microsoft.ApiManagement/service/apim-name/apis/another-api-name?api-version=2022-04-01-preview failed with status code 409. Content is '{"error":{"code":"PessimisticConcurrencyConflict","message":"Operation on the API is in progress","details":null}}'. build 27-Feb-2024 10:57:33 at common.HttpPipelineExtensions.Validate(Response response, Uri requestUri)

Expected behavior

We would like to be able to run publishing without errors.

Actual behavior

We have a quite large list of objects (APIs, products, tags, NVs, backends) we publish with APIOPS. Unfortunately publishing process fails on the random API (all objects before are deployed fine) with one of two errors:

  • System.Net.Http.HttpRequestException: HTTP request to URI https://management.azure.com/subscriptions/sub/resourceGroups/apim-name/providers/Microsoft.ApiManagement/service/apim-name/apis/api-name?api-version=2022-04-01-preview failed with status code 422. Content is '{"error":{"code":"ManagementApiRequestFailed","message":"Failed to connect to management endpoint apim-name.management.azure-api.net:3443 for a service deployed in a Virtual Network. Make sure to follow guidance at https://aka.ms/apim-vnet-common-issues for Inbound connectivity to Management endpoint. Check 'ApiManagement Control Plane - inbound' connectivity at https://aka.ms/apimnetworkstatus.","details":null,"innerError":null}}'.
  • System.Net.Http.HttpRequestException: HTTP request to URI https://management.azure.com/subscriptions/sub/resourceGroups/apim-name/providers/Microsoft.ApiManagement/service/apim-name/apis/another-api-name?api-version=2022-04-01-preview failed with status code 409. Content is '{"error":{"code":"PessimisticConcurrencyConflict","message":"Operation on the API is in progress","details":null}}'. build 27-Feb-2024 10:57:33 at common.HttpPipelineExtensions.Validate(Response response, Uri requestUri)

Interestingly this was happening rarely on all our environments, but recently (since a month or so) it almost always fails on our UAT instance of APIM, but other environments are still affected at 1/10 of deployments.

Reproduction Steps

We cannot share contents of our repo here, but can run it during the online meeting.

Copy link

  Thank you for opening this issue! Please be patient while we will look into it and get back to you as this is an open source project. In the meantime make sure you take a look at the [closed issues](https://github.com/Azure/apiops/issues?q=is%3Aissue+is%3Aclosed) in case your question has already been answered. Don't forget to provide any additional information if needed (e.g. scrubbed logs, detailed feature requests,etc.).
  Whenever it's feasible, please don't hesitate to send a Pull Request (PR) our way. We'd greatly appreciate it, and we'll gladly assess and incorporate your changes.

@mgrabarz
Copy link
Author

mgrabarz commented Feb 29, 2024

Perhaps this is related to numer of objects being published - maybe we hit hardware limits, management API quotas, West EU resource shortage?

  • 28 backends
  • 43 NamedValues
  • 23 Products
  • 36 tags
  • 31 VersionSets
  • other objects.
  • 28 APIs (they go as very last resource type and usually fail at 15th-20th API)

@mgrabarz
Copy link
Author

Since these look like transient errors, maybe there should be retry policy implemented somewhere here: https://github.com/Azure/apiops/blob/156314ff120d1ae7ccbc392699a0fd09270a611d/tools/code/publisher/Program.cs#L193C1-L194C1 and number of retries provided as configuration parameter.

@waelkdouh
Copy link
Contributor

I feel like this topic has been discussed before. Can you please take a look at the closed issues and if you can't find anything, let me know and I will loop in the lead dev on this.

@mgrabarz
Copy link
Author

It was discussed under 141 and was fixed.

It seems we are facing similar problem with apiops v5. The last comment in 141 mentioned that adding versionsets may cause it - will check and let you know tomorrow.

@waelkdouh
Copy link
Contributor

If that resolves it please remember to tag this as a duplicate before you close.

@mgrabarz
Copy link
Author

mgrabarz commented Mar 4, 2024

We did couple of runs to find any pattern, unfortunately it is still failing on random APIs.

Below call stacks of both types of errors:

crit: Publisher[0]
build   04-Mar-2024 11:38:08         System.Net.Http.HttpRequestException: HTTP request to URI https://management.azure.com/subscriptions/XXXXXXXXXXXX/resourceGroups/XXXXXXXXX/providers/Microsoft.ApiManagement/service/xxxxxxxxxx/apis/ksef-invoice?api-version=2022-04-01-preview failed with status code 409. Content is '{"error":{"code":"PessimisticConcurrencyConflict","message":"Operation on the API is in progress","details":null}}'.
build   04-Mar-2024 11:38:08            at common.HttpPipelineExtensions.Validate(Response response, Uri requestUri)
build   04-Mar-2024 11:38:08            at common.HttpPipelineExtensions.PutResource(HttpPipeline pipeline, Uri uri, JsonObject resource, CancellationToken cancellationToken)
build   04-Mar-2024 11:38:08            at publisher.Program.<>c__DisplayClass12_0.<<GetPutRestResource>b__0>d.MoveNext()
build   04-Mar-2024 11:38:08         --- End of stack trace from previous location ---
build   04-Mar-2024 11:38:08            at publisher.Api.PutApi(ApiName apiName, ApiInformationFile apiInformationFile, ApiSpecificationFile specificationFile, JsonObject configurationApiJson, ServiceUri serviceUri, PutRestResource putRestResource, ILogger logger, CancellationToken cancellationToken)
build   04-Mar-2024 11:38:08            at publisher.Api.<>c__DisplayClass23_0.<<ProcessArtifactsToPut>b__4>d.MoveNext()
build   04-Mar-2024 11:38:08         --- End of stack trace from previous location ---
build   04-Mar-2024 11:38:08            at System.Threading.Tasks.Parallel.<>c__50`1.<<ForEachAsync>b__50_0>d.MoveNext()
build   04-Mar-2024 11:38:08         --- End of stack trace from previous location ---
build   04-Mar-2024 11:38:08            at common.IEnumerableExtensions.ForEachParallel[T](IEnumerable`1 enumerable, Func`2 action, CancellationToken cancellationToken)
build   04-Mar-2024 11:38:08            at publisher.Api.ProcessArtifactsToPut(IReadOnlyCollection`1 files, JsonObject configurationJson, ServiceDirectory serviceDirectory, ServiceUri serviceUri, PutRestResource putRestResource, ILogger logger, CancellationToken cancellationToken)
build   04-Mar-2024 11:38:08            at publisher.Service.ProcessArtifactsToPut(IReadOnlyCollection`1 files, JsonObject configurationJson, ServiceDirectory serviceDirectory, ServiceUri serviceUri, ListRestResources listRestResources, PutRestResource putRestResource, DeleteRestResource deleteRestResource, ILogger logger, CancellationToken cancellationToken)
build   04-Mar-2024 11:38:08            at publisher.Publisher.RunWithoutCommitId(CancellationToken cancellationToken)
build   04-Mar-2024 11:38:08            at publisher.Publisher.Run(CancellationToken cancellationToken)
build   04-Mar-2024 11:38:08            at publisher.Publisher.ExecuteAsync(CancellationToken cancellationToken)
build   04-Mar-2024 11:38:08   info: Microsoft.Hosting.Lifetime[0]
build   04-Mar-2024 11:38:08         Application is shutting down...
build   04-Mar-2024 11:38:08   fail: Microsoft.Extensions.Hosting.Internal.Host[9]
build   04-Mar-2024 11:38:08         BackgroundService failed
build   04-Mar-2024 11:38:08         System.Net.Http.HttpRequestException: HTTP request to URI https://management.azure.com/subscriptions/XXXXXXXXXXXX/resourceGroups/XXXXXXXXX/providers/Microsoft.ApiManagement/service/xxxxxxxxxx/apis/ksef-invoice?api-version=2022-04-01-preview failed with status code 409. Content is '{"error":{"code":"PessimisticConcurrencyConflict","message":"Operation on the API is in progress","details":null}}'.
build   04-Mar-2024 11:38:08            at common.HttpPipelineExtensions.Validate(Response response, Uri requestUri)
build   04-Mar-2024 11:38:08            at common.HttpPipelineExtensions.PutResource(HttpPipeline pipeline, Uri uri, JsonObject resource, CancellationToken cancellationToken)
build   04-Mar-2024 11:38:08            at publisher.Program.<>c__DisplayClass12_0.<<GetPutRestResource>b__0>d.MoveNext()
build   04-Mar-2024 11:38:08         --- End of stack trace from previous location ---
build   04-Mar-2024 11:38:08            at publisher.Api.PutApi(ApiName apiName, ApiInformationFile apiInformationFile, ApiSpecificationFile specificationFile, JsonObject configurationApiJson, ServiceUri serviceUri, PutRestResource putRestResource, ILogger logger, CancellationToken cancellationToken)
build   04-Mar-2024 11:38:08            at publisher.Api.<>c__DisplayClass23_0.<<ProcessArtifactsToPut>b__4>d.MoveNext()
build   04-Mar-2024 11:38:08         --- End of stack trace from previous location ---
build   04-Mar-2024 11:38:08            at System.Threading.Tasks.Parallel.<>c__50`1.<<ForEachAsync>b__50_0>d.MoveNext()
build   04-Mar-2024 11:38:08         --- End of stack trace from previous location ---
build   04-Mar-2024 11:38:08            at common.IEnumerableExtensions.ForEachParallel[T](IEnumerable`1 enumerable, Func`2 action, CancellationToken cancellationToken)
build   04-Mar-2024 11:38:08            at publisher.Api.ProcessArtifactsToPut(IReadOnlyCollection`1 files, JsonObject configurationJson, ServiceDirectory serviceDirectory, ServiceUri serviceUri, PutRestResource putRestResource, ILogger logger, CancellationToken cancellationToken)
build   04-Mar-2024 11:38:08            at publisher.Service.ProcessArtifactsToPut(IReadOnlyCollection`1 files, JsonObject configurationJson, ServiceDirectory serviceDirectory, ServiceUri serviceUri, ListRestResources listRestResources, PutRestResource putRestResource, DeleteRestResource deleteRestResource, ILogger logger, CancellationToken cancellationToken)
build   04-Mar-2024 11:38:08            at publisher.Publisher.RunWithoutCommitId(CancellationToken cancellationToken)
build   04-Mar-2024 11:38:08            at publisher.Publisher.Run(CancellationToken cancellationToken)
build   04-Mar-2024 11:38:08            at publisher.Publisher.ExecuteAsync(CancellationToken cancellationToken)
build   04-Mar-2024 11:38:08            at Microsoft.Extensions.Hosting.Internal.Host.TryExecuteBackgroundServiceAsync(BackgroundService backgroundService)
build   04-Mar-2024 11:38:08   dbug: Microsoft.Extensions.Hosting.Internal.Host[3]
build   04-Mar-2024 11:38:08         Hosting stopping
build   04-Mar-2024 11:38:08   crit: Microsoft.Extensions.Hosting.Internal.Host[10]
build   04-Mar-2024 11:38:08         The HostOptions.BackgroundServiceExceptionBehavior is configured to StopHost. A BackgroundService has thrown an unhandled exception, and the IHost instance is stopping. To avoid this behavior, configure this to Ignore; however the BackgroundService will not be restarted.
build   04-Mar-2024 11:38:08         System.Net.Http.HttpRequestException: HTTP request to URI  https://management.azure.com/subscriptions/XXXXXXXXXXXX/resourceGroups/XXXXXXXXX/providers/Microsoft.ApiManagement/service/xxxxxxxxxx/apis/ksef-invoice?api-version=2022-04-01-previewfailed with status code 409. Content is '{"error":{"code":"PessimisticConcurrencyConflict","message":"Operation on the API is in progress","details":null}}'.
build   04-Mar-2024 11:38:08            at common.HttpPipelineExtensions.Validate(Response response, Uri requestUri)
build   04-Mar-2024 11:38:08            at common.HttpPipelineExtensions.PutResource(HttpPipeline pipeline, Uri uri, JsonObject resource, CancellationToken cancellationToken)
build   04-Mar-2024 11:38:08            at publisher.Program.<>c__DisplayClass12_0.<<GetPutRestResource>b__0>d.MoveNext()
build   04-Mar-2024 11:38:08         --- End of stack trace from previous location ---
build   04-Mar-2024 11:38:08            at publisher.Api.PutApi(ApiName apiName, ApiInformationFile apiInformationFile, ApiSpecificationFile specificationFile, JsonObject configurationApiJson, ServiceUri serviceUri, PutRestResource putRestResource, ILogger logger, CancellationToken cancellationToken)
build   04-Mar-2024 11:38:08            at publisher.Api.<>c__DisplayClass23_0.<<ProcessArtifactsToPut>b__4>d.MoveNext()
build   04-Mar-2024 11:38:08         --- End of stack trace from previous location ---
build   04-Mar-2024 11:38:08            at System.Threading.Tasks.Parallel.<>c__50`1.<<ForEachAsync>b__50_0>d.MoveNext()
build   04-Mar-2024 11:38:08         --- End of stack trace from previous location ---
build   04-Mar-2024 11:38:08            at common.IEnumerableExtensions.ForEachParallel[T](IEnumerable`1 enumerable, Func`2 action, CancellationToken cancellationToken)
build   04-Mar-2024 11:38:08            at publisher.Api.ProcessArtifactsToPut(IReadOnlyCollection`1 files, JsonObject configurationJson, ServiceDirectory serviceDirectory, ServiceUri serviceUri, PutRestResource putRestResource, ILogger logger, CancellationToken cancellationToken)
build   04-Mar-2024 11:38:08            at publisher.Service.ProcessArtifactsToPut(IReadOnlyCollection`1 files, JsonObject configurationJson, ServiceDirectory serviceDirectory, ServiceUri serviceUri, ListRestResources listRestResources, PutRestResource putRestResource, DeleteRestResource deleteRestResource, ILogger logger, CancellationToken cancellationToken)
build   04-Mar-2024 11:38:08            at publisher.Publisher.RunWithoutCommitId(CancellationToken cancellationToken)
build   04-Mar-2024 11:38:08            at publisher.Publisher.Run(CancellationToken cancellationToken)
build   04-Mar-2024 11:38:08            at publisher.Publisher.ExecuteAsync(CancellationToken cancellationToken)
build   04-Mar-2024 11:38:08            at Microsoft.Extensions.Hosting.Internal.Host.TryExecuteBackgroundServiceAsync(BackgroundService backgroundService)
build   04-Mar-2024 11:38:08   dbug: Microsoft.Extensions.Hosting.Internal.Host[4]
build   04-Mar-2024 11:38:08         Hosting stopped

and 422:

failed with status code 422. Content is '{"error":{"code":"ManagementApiRequestFailed","message":"Failed to connect to management endpoint xxxxx.management.azure-api.net:3443 for a service deployed in a Virtual Network. Make sure to follow guidance at https://aka.ms/apim-vnet-common-issues for Inbound connectivity to Management endpoint. Check 'ApiManagement Control Plane - inbound' connectivity at [https://aka.ms/apimnetworkstatus.","details":null,"innerError":null}](https://aka.ms/apimnetworkstatus.%22,%22details%22:null,%22innerError%22:null%7d)}'.
build   04-Mar-2024 09:28:40            at common.HttpPipelineExtensions.Validate(Response response, Uri requestUri)
build   04-Mar-2024 09:28:40            at common.HttpPipelineExtensions.WaitForLongRunningOperation(HttpPipeline pipeline, Response response, CancellationToken cancellationToken)
build   04-Mar-2024 09:28:40            at common.HttpPipelineExtensions.PutResource(HttpPipeline pipeline, Uri uri, JsonObject resource, CancellationToken cancellationToken)
build   04-Mar-2024 09:28:40            at publisher.Program.<>c__DisplayClass12_0.<<GetPutRestResource>b__0>d.MoveNext()
build   04-Mar-2024 09:28:40         --- End of stack trace from previous location ---
build   04-Mar-2024 09:28:40            at publisher.Api.PutApi(ApiName apiName, ApiInformationFile apiInformationFile, ApiSpecificationFile specificationFile, JsonObject configurationApiJson, ServiceUri serviceUri, PutRestResource putRestResource, ILogger logger, CancellationToken cancellationToken)
build   04-Mar-2024 09:28:40            at publisher.Api.<>c__DisplayClass23_0.<<ProcessArtifactsToPut>b__4>d.MoveNext()
build   04-Mar-2024 09:28:40         --- End of stack trace from previous location ---
build   04-Mar-2024 09:28:40            at System.Threading.Tasks.Parallel.<>c__50`1.<<ForEachAsync>b__50_0>d.MoveNext()
build   04-Mar-2024 09:28:40         --- End of stack trace from previous location ---
build   04-Mar-2024 09:28:40            at common.IEnumerableExtensions.ForEachParallel[T](IEnumerable`1 enumerable, Func`2 action, CancellationToken cancellationToken)
build   04-Mar-2024 09:28:40            at publisher.Api.ProcessArtifactsToPut(IReadOnlyCollection`1 files, JsonObject configurationJson, ServiceDirectory serviceDirectory, ServiceUri serviceUri, PutRestResource putRestResource, ILogger logger, CancellationToken cancellationToken)
build   04-Mar-2024 09:28:40            at publisher.Service.ProcessArtifactsToPut(IReadOnlyCollection`1 files, JsonObject configurationJson, ServiceDirectory serviceDirectory, ServiceUri serviceUri, ListRestResources listRestResources, PutRestResource putRestResource, DeleteRestResource deleteRestResource, ILogger logger, CancellationToken cancellationToken)
build   04-Mar-2024 09:28:40            at publisher.Publisher.RunWithoutCommitId(CancellationToken cancellationToken)
build   04-Mar-2024 09:28:40            at publisher.Publisher.Run(CancellationToken cancellationToken)
build   04-Mar-2024 09:28:40            at publisher.Publisher.ExecuteAsync(CancellationToken cancellationToken)
build   04-Mar-2024 09:28:40            at Microsoft.Extensions.Hosting.Internal.Host.TryExecuteBackgroundServiceAsync(BackgroundService backgroundService)
build   04-Mar-2024 09:28:40   dbug: Microsoft.Extensions.Hosting.Internal.Host[3]
build   04-Mar-2024 09:28:40         Hosting stopping
build   04-Mar-2024 09:28:40   crit: Microsoft.Extensions.Hosting.Internal.Host[10]
build   04-Mar-2024 09:28:40         The HostOptions.BackgroundServiceExceptionBehavior is configured to StopHost. A BackgroundService has thrown an unhandled exception, and the IHost instance is stopping. To avoid this behavior, configure this to Ignore; however the BackgroundService will not be restarted.

@guythetechie
Copy link
Contributor

@mgrabarz - the code should already use these default retry settings. Your 422 error message indicates a connectivity failure with your APIM service that lives in a VNET.

If you enable Trace logging, you should see the contents of each PUT request (including the ones that fail). Can you share the contents of one of those failing API calls? Please sanitize the logs before sharing.

@mgrabarz
Copy link
Author

mgrabarz commented Mar 5, 2024

When sanitising the PUT logs I just noticed that API being put at
URI management.azure.com/subscriptions/subID/resourceGroups/xxx-resougroup-uat-1/providers/Microsoft.ApiManagement/service/xxx-APIM-uat-1/apis/apiName?api-version=2022-04-01-preview..

References the following VersionSet in the body: "apiVersionSetId": "/subscriptions/subId/resourceGroups/xxx-resougroup-dev-1/providers/Microsoft.ApiManagement/service/xxx-APIM-dev-1/apiVersionSets/yyy

Not sure if this is generating the errors and what is the root cause of these being part of the body (extractor maybe, or pull request error), but need to investigate. I will reach back to you with findings.

@adkasperski
Copy link

The code is exported from the DEV environment, so a snapshot of what is set in DEV is pulling to bitbucket. When publishing, we indicate the configuration file with which we overwrite some values, e.g. backends, namedValues, diagnostics. We follow https://github.com/Azure/apiops/blob/main/configuration.prod.yaml
I haven't found any information anywhere that requires overwriting apiVersionSetId. In other environments, the publisher handles this.

@adkasperski
Copy link

I replaced the references in the code before publishing. The same errors appear, so these references do not matter, especially since the publication is successful in a different environment (SIT).

@adkasperski
Copy link

Sample http 422 error with trace=true when publishing API:

crit: Publisher[0]
System.Net.Http.HttpRequestException: HTTP request to URI https://management.azure.com/subscriptions/xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx/resourceGroups/xxx-xxx-xxxxxx-resougroup-pre-1/providers/Microsoft.ApiManagement/service/xxxx-xxx-xxxxx-APIM-pre-1/apis/kojot-risks-sls?api-version=2022-04-01-preview&asyncId=65e9c35d4634611804b2f14a&asyncCode=200&t=638454155601197471&c=MIIHADCCBeigAwIBAgITHgPqjiEYPbwplso53QAAA-qOITANBgkqh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3THTIw3ykZDXyYwk7yv94xHqlfQIRZsex4HYQ4WKwtU7x2suTztZ-F8ps-IIh-wSxr005kAmMunvpSpoTp4cmx8cUv68vtCj-iCL7b3R3uZRO2FYiNibQP5c3NgyURhem3d2_itbwFWBo3tXCfm-iQkevoQfx8h9YeitwpIXlFHVRRbbdls8uN0vCF7bUUHTuAkzGw_DuC9LiMV9upIk&s=iQdEuXQ_zv4OJ66KeMpxUDMH_6hOjf7TxhZ8EbFohIhL-48ytJEklL2qaJsflHzqqVO1BizQueLHCyIb3cbL5piM3ufL4PEXoqmgaWJoBY8IYgl2fvslI40iV7Vg_tQOFidlW6PRLaexU7PiLURskFS63hA1YFQGw-R04G9JKLX8LoBFxRAZqqAPLK25UmSBCfdECg5CLxD2RDmd762TRZSgEpXZTx2JctoKdEntHkk0-NueyjbyQ_m08UEsZuTRv5imK67XDF1xyYUtGe82uRpR4vft8aQqsBmv3zh49AfLVbMMv5yX6ju6g0TqrDCtRX4oft0IhUnEYKtsa-P3Sw&h=f4y2gAxBfjT30-AVZyGi2NljfG6zxytUfjfJWHyK2Fg failed with status code 422. Content is '{"error":{"code":"ManagementApiRequestFailed","message":"Failed to connect to management endpoint xxxx-xxx-xxxxx-APIM-pre-1.management.azure-api.net:3443 for a service deployed in a Virtual Network. Make sure to follow guidance at https://aka.ms/apim-vnet-common-issues for Inbound connectivity to Management endpoint. Check 'ApiManagement Control Plane - inbound' connectivity at https://aka.ms/apimnetworkstatus.","details":null,"innerError":null}}'.
at common.HttpPipelineExtensions.Validate(Response response, Uri requestUri)
at common.HttpPipelineExtensions.WaitForLongRunningOperation(HttpPipeline pipeline, Response response, CancellationToken cancellationToken)
at common.HttpPipelineExtensions.PutResource(HttpPipeline pipeline, Uri uri, JsonObject resource, CancellationToken cancellationToken)
at publisher.Program.<>c__DisplayClass12_0.<b__0>d.MoveNext()
--- End of stack trace from previous location ---
at publisher.Api.PutApi(ApiName apiName, ApiInformationFile apiInformationFile, ApiSpecificationFile specificationFile, JsonObject configurationApiJson, ServiceUri serviceUri, PutRestResource putRestResource, ILogger logger, CancellationToken cancellationToken)
at publisher.Api.<>c__DisplayClass23_0.<b__4>d.MoveNext()
--- End of stack trace from previous location ---
at System.Threading.Tasks.Parallel.<>c__501.<<ForEachAsync>b__50_0>d.MoveNext() --- End of stack trace from previous location --- at common.IEnumerableExtensions.ForEachParallel[T](IEnumerable1 enumerable, Func2 action, CancellationToken cancellationToken) at publisher.Api.ProcessArtifactsToPut(IReadOnlyCollection1 files, JsonObject configurationJson, ServiceDirectory serviceDirectory, ServiceUri serviceUri, PutRestResource putRestResource, ILogger logger, CancellationToken cancellationToken)
at publisher.Service.ProcessArtifactsToPut(IReadOnlyCollection1 files, JsonObject configurationJson, ServiceDirectory serviceDirectory, ServiceUri serviceUri, ListRestResources listRestResources, PutRestResource putRestResource, DeleteRestResource deleteRestResource, ILogger logger, CancellationToken cancellationToken) at publisher.Publisher.RunWithoutCommitId(CancellationToken cancellationToken) at publisher.Publisher.Run(CancellationToken cancellationToken) at publisher.Publisher.ExecuteAsync(CancellationToken cancellationToken) info: Microsoft.Hosting.Lifetime[0] Application is shutting down... fail: Microsoft.Extensions.Hosting.Internal.Host[9] BackgroundService failed System.Net.Http.HttpRequestException: HTTP request to URI https://management.azure.com/subscriptions/xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx/resourceGroups/xxx-xxx-xxxxxx-resougroup-pre-1/providers/Microsoft.ApiManagement/service/xxxx-xxx-xxxxx-APIM-pre-1/apis/kojot-risks-sls?api-version=2022-04-01-preview&asyncId=65e9c35d4634611804b2f14a&asyncCode=200&t=638454155601197471&c=MIIHADCCBeigAwIBAgITHgPqjiEYPbwplso53QAAA-qOITANBgkqhkiG9w0BAQsFADBEMRMwEQYKCZImiZPyLGQBGRYDR0JMMRMwEQYKCZImiZPyLGQBGRYDQU1FMRgwFgYDVQQDEw9BTUUgSW5mcmEgQ0EgMDYwHhcNMjQwMTMxMTUwNjMwWhcNMjUwMTI1MTUwN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oQfx8h9YeitwpIXlFHVRRbbdls8uN0vCF7bUUHTuAkzGw_DuC9LiMV9upIk&s=iQdEuXQ_zv4OJ66KeMpxUDMH_6hOjf7TxhZ8EbFohIhL-48ytJEklL2qaJsflHzqqVO1BizQueLHCyIb3cbL5piM3ufL4PEXoqmgaWJoBY8IYgl2fvslI40iV7Vg_tQOFidlW6PRLaexU7PiLURskFS63hA1YFQGw-R04G9JKLX8LoBFxRAZqqAPLK25UmSBCfdECg5CLxD2RDmd762TRZSgEpXZTx2JctoKdEntHkk0-NueyjbyQ_m08UEsZuTRv5imK67XDF1xyYUtGe82uRpR4vft8aQqsBmv3zh49AfLVbMMv5yX6ju6g0TqrDCtRX4oft0IhUnEYKtsa-P3Sw&h=f4y2gAxBfjT30-AVZyGi2NljfG6zxytUfjfJWHyK2Fg failed with status code 422. Content is '{"error":{"code":"ManagementApiRequestFailed","message":"Failed to connect to management endpoint xxxx-xxx-xxxxx-APIM-pre-1.management.azure-api.net:3443 for a service deployed in a Virtual Network. Make sure to follow guidance at https://aka.ms/apim-vnet-common-issues for Inbound connectivity to Management endpoint. Check 'ApiManagement Control Plane - inbound' connectivity at https://aka.ms/apimnetworkstatus.","details":null,"innerError":null}}'. at common.HttpPipelineExtensions.Validate(Response response, Uri requestUri) at common.HttpPipelineExtensions.WaitForLongRunningOperation(HttpPipeline pipeline, Response response, CancellationToken cancellationToken) at common.HttpPipelineExtensions.PutResource(HttpPipeline pipeline, Uri uri, JsonObject resource, CancellationToken cancellationToken) at publisher.Program.<>c__DisplayClass12_0.<<GetPutRestResource>b__0>d.MoveNext() --- End of stack trace from previous location --- at publisher.Api.PutApi(ApiName apiName, ApiInformationFile apiInformationFile, ApiSpecificationFile specificationFile, JsonObject configurationApiJson, ServiceUri serviceUri, PutRestResource putRestResource, ILogger logger, CancellationToken cancellationToken) at publisher.Api.<>c__DisplayClass23_0.<<ProcessArtifactsToPut>b__4>d.MoveNext() --- End of stack trace from previous location --- at System.Threading.Tasks.Parallel.<>c__501.<b__50_0>d.MoveNext()
--- End of stack trace from previous location ---
at common.IEnumerableExtensions.ForEachParallel[T](IEnumerable1 enumerable, Func2 action, CancellationToken cancellationToken)
at publisher.Api.ProcessArtifactsToPut(IReadOnlyCollection1 files, JsonObject configurationJson, ServiceDirectory serviceDirectory, ServiceUri serviceUri, PutRestResource putRestResource, ILogger logger, CancellationToken cancellationToken) at publisher.Service.ProcessArtifactsToPut(IReadOnlyCollection1 files, JsonObject configurationJson, ServiceDirectory serviceDirectory, ServiceUri serviceUri, ListRestResources listRestResources, PutRestResource putRestResource, DeleteRestResource deleteRestResource, ILogger logger, CancellationToken cancellationToken)
at publisher.Publisher.RunWithoutCommitId(CancellationToken cancellationToken)
at publisher.Publisher.Run(CancellationToken cancellationToken)
at publisher.Publisher.ExecuteAsync(CancellationToken cancellationToken)
at Microsoft.Extensions.Hosting.Internal.Host.TryExecuteBackgroundServiceAsync(BackgroundService backgroundService)
dbug: Microsoft.Extensions.Hosting.Internal.Host[3]
Hosting stopping
dbug: Microsoft.Extensions.Hosting.Internal.Host[4]
Hosting stopped
crit: Microsoft.Extensions.Hosting.Internal.Host[10]
The HostOptions.BackgroundServiceExceptionBehavior is configured to StopHost. A BackgroundService has thrown an unhandled exception, and the IHost instance is stopping. To avoid this behavior, configure this to Ignore; however the BackgroundService will not be restarted.
System.Net.Http.HttpRequestException: HTTP request to URI https://management.azure.com/subscriptions/xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx/resourceGroups/xxx-xxx-xxxxxx-resougroup-pre-1/providers/Microsoft.ApiManagement/service/xxxx-xxx-xxxxx-APIM-pre-1/apis/kojot-risks-sls?api-version=2022-04-01-preview&asyncId=65e9c35d4634611804b2f14a&asyncCode=200&t=638454155601197471&c=MIIHADCCBeigAwIBAgITHgPqjiEYPbwplso53QAAA-qOITANBgkqhkiG9w0BAQsFADBEMRMwEQYKCZImiZPyLGQBGRYDR0JMMRMwEQYKCZImiZPyLGQBGRYDQU1FMRgwFgYDVQQD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x8cUv68vtCj-iCL7b3R3uZRO2FYiNibQP5c3NgyURhem3d2_itbwFWBo3tXCfm-iQkevoQfx8h9YeitwpIXlFHVRRbbdls8uN0vCF7bUUHTuAkzGw_DuC9LiMV9upIk&s=iQdEuXQ_zv4OJ66KeMpxUDMH_6hOjf7TxhZ8EbFohIhL-48ytJEklL2qaJsflHzqqVO1BizQueLHCyIb3cbL5piM3ufL4PEXoqmgaWJoBY8IYgl2fvslI40iV7Vg_tQOFidlW6PRLaexU7PiLURskFS63hA1YFQGw-R04G9JKLX8LoBFxRAZqqAPLK25UmSBCfdECg5CLxD2RDmd762TRZSgEpXZTx2JctoKdEntHkk0-NueyjbyQ_m08UEsZuTRv5imK67XDF1xyYUtGe82uRpR4vft8aQqsBmv3zh49AfLVbMMv5yX6ju6g0TqrDCtRX4oft0IhUnEYKtsa-P3Sw&h=f4y2gAxBfjT30-AVZyGi2NljfG6zxytUfjfJWHyK2Fg failed with status code 422. Content is '{"error":{"code":"ManagementApiRequestFailed","message":"Failed to connect to management endpoint xxxx-xxx-xxxxx-APIM-pre-1.management.azure-api.net:3443 for a service deployed in a Virtual Network. Make sure to follow guidance at https://aka.ms/apim-vnet-common-issues for Inbound connectivity to Management endpoint. Check 'ApiManagement Control Plane - inbound' connectivity at https://aka.ms/apimnetworkstatus.","details":null,"innerError":null}}'.
at common.HttpPipelineExtensions.Validate(Response response, Uri requestUri)
at common.HttpPipelineExtensions.WaitForLongRunningOperation(HttpPipeline pipeline, Response response, CancellationToken cancellationToken)
at common.HttpPipelineExtensions.PutResource(HttpPipeline pipeline, Uri uri, JsonObject resource, CancellationToken cancellationToken)
at publisher.Program.<>c__DisplayClass12_0.<b__0>d.MoveNext()
--- End of stack trace from previous location ---
at publisher.Api.PutApi(ApiName apiName, ApiInformationFile apiInformationFile, ApiSpecificationFile specificationFile, JsonObject configurationApiJson, ServiceUri serviceUri, PutRestResource putRestResource, ILogger logger, CancellationToken cancellationToken)
at publisher.Api.<>c__DisplayClass23_0.<b__4>d.MoveNext()
--- End of stack trace from previous location ---
at System.Threading.Tasks.Parallel.<>c__501.<<ForEachAsync>b__50_0>d.MoveNext() --- End of stack trace from previous location --- at common.IEnumerableExtensions.ForEachParallel[T](IEnumerable1 enumerable, Func2 action, CancellationToken cancellationToken) at publisher.Api.ProcessArtifactsToPut(IReadOnlyCollection1 files, JsonObject configurationJson, ServiceDirectory serviceDirectory, ServiceUri serviceUri, PutRestResource putRestResource, ILogger logger, CancellationToken cancellationToken)
at publisher.Service.ProcessArtifactsToPut(IReadOnlyCollection`1 files, JsonObject configurationJson, ServiceDirectory serviceDirectory, ServiceUri serviceUri, ListRestResources listRestResources, PutRestResource putRestResource, DeleteRestResource deleteRestResource, ILogger logger, CancellationToken cancellationToken)
at publisher.Publisher.RunWithoutCommitId(CancellationToken cancellationToken)
at publisher.Publisher.Run(CancellationToken cancellationToken)
at publisher.Publisher.ExecuteAsync(CancellationToken cancellationToken)
at Microsoft.Extensions.Hosting.Internal.Host.TryExecuteBackgroundServiceAsync(BackgroundService backgroundService)

@adkasperski
Copy link

adkasperski commented Mar 7, 2024

Sample http 409 error form publisher trace:

info: Publisher[0]
Putting API ksef-invoice...
trce: PutRestResource[0]
Beginning request to put REST resource {
"properties": {
"apiRevision": "1",
"apiVersion": "v1",
"apiVersionSetId": "/subscriptions/xxxxxxxxxxxxxxxxxxxxxxxx/resourceGroups/xxxx-xxx-xxxxx-resougroup-pre-1/providers/Microsoft.ApiManagement/service/xxxx-xxx-xxxxx-pre-1/apiVersionSets/xxxxxxxxxxxxxxxxxxxxxxx",
"authenticationSettings": {},
"contact": {
"email": integracja@pzu.pl,
"name": "ksef-invoice",
"url": [......])
},
"description": ".........",
"displayName": "ksef-invoice",
"isCurrent": true,
"license": {
"name": "Grupa",
"url": http://www.
},
"path": "ksef/invoice",
"protocols": [
"http",
"https"
],
"serviceUrl": https://xxxxxx/ksef/invoice/v1,
"subscriptionKeyParameterNames": {
"header": "Ocp-Apim-Subscription-Key",
"query": "subscription-key"
},
"subscriptionRequired": false,
"format": "openapi",
"value": "{.....................}"
}
} at URI https://management.azure.com/subscriptions/xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx/resourceGroups/xxxx-xxx-xxxxx-resougroup-pre-1/providers/Microsoft.ApiManagement/service/xxxx-xxx-xxxxx-pre-1/apis/ksef-invoice?api-version=2022-04-01-preview...
crit: Publisher[0]
System.Net.Http.HttpRequestException: HTTP request to URI https://management.azure.com/subscriptions/xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx/resourceGroups/xxxx-xxx-xxxxx-resougroup-pre-1/providers/Microsoft.ApiManagement/service/xxxx-xxx-xxxxx-pre-1/apis/ksef-invoice?api-version=2022-04-01-preview failed with status code 409. Content is '{"error":{"code":"ManagementApiRequestFailed","message":"Connection was closed unexpectedly by endpoint xxxx-xxx-xxxxx-pre-1.management.azure-api.net:3443 for the Developer SKU service which will have inherent downtime during underneath platform upgrades. Please refer to SLA at https://aka.ms/apimsla and considering upgrading to a SKU Tier with higher SLA.","details":null,"innerError":null}}'.
at common.HttpPipelineExtensions.Validate(Response response, Uri requestUri)
at common.HttpPipelineExtensions.PutResource(HttpPipeline pipeline, Uri uri, JsonObject resource, CancellationToken cancellationToken)
at publisher.Program.<>c__DisplayClass12_0.<b__0>d.MoveNext()
--- End of stack trace from previous location ---
at publisher.Api.PutApi(ApiName apiName, ApiInformationFile apiInformationFile, ApiSpecificationFile specificationFile, JsonObject configurationApiJson, ServiceUri serviceUri, PutRestResource putRestResource, ILogger logger, CancellationToken cancellationToken)
at publisher.Api.<>c__DisplayClass23_0.<b__4>d.MoveNext()
--- End of stack trace from previous location ---
at System.Threading.Tasks.Parallel.<>c__501.<<ForEachAsync>b__50_0>d.MoveNext() --- End of stack trace from previous location --- at common.IEnumerableExtensions.ForEachParallel[T](IEnumerable1 enumerable, Func2 action, CancellationToken cancellationToken) at publisher.Api.ProcessArtifactsToPut(IReadOnlyCollection1 files, JsonObject configurationJson, ServiceDirectory serviceDirectory, ServiceUri serviceUri, PutRestResource putRestResource, ILogger logger, CancellationToken cancellationToken)
at publisher.Service.ProcessArtifactsToPut(IReadOnlyCollection`1 files, JsonObject configurationJson, ServiceDirectory serviceDirectory, ServiceUri serviceUri, ListRestResources listRestResources, PutRestResource putRestResource, DeleteRestResource deleteRestResource, ILogger logger, CancellationToken cancellationToken)
at publisher.Publisher.RunWithoutCommitId(CancellationToken cancellationToken)
at publisher.Publisher.Run(CancellationToken cancellationToken)
at publisher.Publisher.ExecuteAsync(CancellationToken cancellationToken)

@guythetechie
Copy link
Contributor

@adkasperski - The version set issue makes sense. You can't publish an API and reference a version set in another APIM instance. You should be able to override any property supported by the REST API in your environment's configuration file. For the version set ID, I expect it will look something like this:

apis
- name: myapi
  properties:
    apiVersionSetId: yourversionsetid

As for last comment, this is not an ApiOps issue - has to do with the fact that you're using the Developer SKU (which has no SLA). Every now and then, the APIM team makes changes to the platform, and instances using that SKU are unavailable while the changes happen. You'll just have to wait and try again later, or use a different SKU.

@guythetechie
Copy link
Contributor

One other thing when overriding: I've noticed that many APIM resource ID properties also support a shorter format if it's in the same instance. Rather than specifying a full version set resource ID that includes the subscription, resource group, and instance name(/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apiVersionSets/{versionSetId}), you may be able to just specify /apiVersionSets/{versionSetId}. Haven't tested this personally, but it might work.

@waelkdouh
Copy link
Contributor

@adkasperski please let us know if the shortened format that @guythetechie is suggesting works so we can update our wiki.

@adkasperski
Copy link

Thanks. I'll check the @guythetechie suggestion and get back the result.

@adkasperski
Copy link

The following configuration works correctly:

apis:

  • name: sample-api
    properties:
    apiVersionSetId: "/apiVersionSets/653f85cb2dbf4ce375624664"

On the other hand if we shorten the API specification, the publisher will also work correctly:

{
"properties": {
"apiRevision": "1",
"apiVersion": "v1",
"apiVersionSetId": "/apiVersionSets/653f85cb2dbf4ce375624664",
....

But it does not resolve the problem. Errors still appear. I think this is not an APIOPs problem, but a problem with the availability of the APIM service. We've already created the ticket to Microsoft APIM Support.

@adkasperski
Copy link

We have noticed that in UAT/PRE environments where these errors occur, the publishing time of individual, even small API components (named values, backends, version set, etc.) takes significantly longer than in the PRD environment where these errors do not occur. Up to several dozen API components are published per second on PRD, while on UAT/PRE it takes more than 10 seconds to publish a single component. We read the publication durations from the Activity Logs in the Management Plane of the APIM service.
Are any timeouts set in apiops tools? And could the publishing problems be caused by some other apiops settings?

@MattiaBonanni
Copy link

Just as a piece of information, but every time we receive a 409 in the publisher pipeline, the APIM Management endpoint seems also irresponsive, so much so I receive an error if I try to open the APIs definitions from the Azure Portal. It happens every time

@guythetechie
Copy link
Contributor

Please see this section in my response. The developer SKU often goes offline for maintenance. I would recommend using non-developer SKUs if you need more availability.

As for last comment, this is not an ApiOps issue - has to do with the fact that you're using the Developer SKU (which has no SLA). Every now and then, the APIM team makes changes to the platform, and instances using that SKU are unavailable while the changes happen. You'll just have to wait and try again later, or use a different SKU.

@MattiaBonanni
Copy link

Just to be sure, only the management portal goes sometimes offline while the gateway still works? I'm asking because when happened to us, request where processed correctly even if the pipeline was failing for those errors.

@adkasperski
Copy link

adkasperski commented Apr 5, 2024

We use Developer SKU for non-production environments.

So we can close this issue.

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

5 participants