Closed markymark501998 closed 1 year ago
I received this error at one point. Turned out that one of the parameters I was passing was blank... think it was the resource group parameter. Hopefully that's it and your unblocked.
@karlrissland I think that is what we were running into. I fixed this a few days ago but didn't get the chance to update this issue yet. I was pointing at either the wrong APIM instance or the wrong resource group (or something else entirely). However, it is interesting that the error message received from the ARM API has little to no correlation in setting the wrong configuration value.
@guythetechie any thoughts? Seems odd to me that having the wrong configuration yields a response from a different API. At least, that is what I think is going on given that our setup is now working and still targeting the "2022-04-01-preview" api-version.
Our guess is that since you are missing the resourcegroup name in the url above, you are calling the resource group api rather than the apim api. That resource group api doesn't have that api version.
Release version
4.1.3
Describe the bug
Using the default extractor pipeline in the Run extractor step, extractor.exe is receiving an API error stating that the api-version is invalid.
Expected behavior
Not to be painfully obvious, but I would expect this API call to work and not fail in a non-configurable situation. In the source code, I found where the version is being hardcoded. I would suggest having maybe having this be adjustable or at least tied to a non-preview version?
/tools/code/extractor/program.cs (line 234)
I assume this issue will affect the publisher as well although I have not tested that yet.
Actual behavior
Upon executing the pipeline, I am greeted with this error (I spared the rest of the stack trace for readability - basically just .net boilerplate failure messages):
System.Net.Http.HttpRequestException: HTTP request to URI https://management.azure.com/subscriptions/***/resourceGroups/providers/Microsoft.ApiManagement/service/namedValues?api-version=2022-04-01-preview failed with status code 400. Content is '{"error":{"code":"InvalidApiVersionParameter","message":"The api-version '2022-04-01-preview' is invalid. The supported versions are '2023-03-01-preview,2022-12-01,2022-11-01-preview,2022-09-01,2022-06-01,2022-05-01,2022-03-01-preview,2022-01-01,2021-04-01,2021-01-01,2020-10-01,2020-09-01,2020-08-01,2020-07-01,2020-06-01,2020-05-01,2020-01-01,2019-11-01,2019-10-01,2019-09-01,2019-08-01,2019-07-01,2019-06-01,2019-05-10,2019-05-01,2019-03-01,2018-11-01,2018-09-01,2018-08-01,2018-07-01,2018-06-01,2018-05-01,2018-02-01,2018-01-01,2017-12-01,2017-08-01,2017-06-01,2017-05-10,2017-05-01,2017-03-01,2016-09-01,2016-07-01,2016-06-01,2016-02-01,2015-11-01,2015-01-01,2014-04-01-preview,2014-04-01,2014-01-01,2013-03-01,2014-02-26,2014-04'."}}'. at common.HttpPipelineExtensions.Validate(Response response, Uri requestUri) at common.HttpPipelineExtensions.GetContent(HttpPipeline pipeline, Uri uri, CancellationToken cancellationToken) at common.HttpPipelineExtensions.GetJsonObject(HttpPipeline pipeline, Uri uri, CancellationToken cancellationToken) at common.HttpPipelineExtensions.ListJsonObjects(HttpPipeline pipeline, Uri uri, CancellationToken cancellationToken)+MoveNext() at common.HttpPipelineExtensions.ListJsonObjects(HttpPipeline pipeline, Uri uri, CancellationToken cancellationToken)+System.Threading.Tasks.Sources.IValueTaskSource.GetResult()
at System.Linq.AsyncEnumerable.SelectEnumerableAsyncIteratorb 54_0>d.MoveNext()
--- End of stack trace from previous location ---
at common.IAsyncEnumerableExtensions.ForEachParallel[T](IAsyncEnumerable
2.MoveNextCore() in /_/Ix.NET/Source/System.Linq.Async/System/Linq/Operators/Select.cs:line 221 at System.Linq.AsyncIteratorBase
1.MoveNextAsync() in //Ix.NET/Source/System.Linq.Async/System/Linq/AsyncIterator.cs:line 70 at System.Linq.AsyncIteratorBase`1.MoveNextAsync() in //Ix.NET/Source/System.Linq.Async/System/Linq/AsyncIterator.cs:line 75 at System.Threading.Tasks.Parallel.<>c54`1.<1 enumerable, Func
2 action, CancellationToken cancellationToken) at extractor.NamedValue.ExportAll(ServiceDirectory serviceDirectory, ServiceUri serviceUri, ListRestResources listRestResources, GetRestResource getRestResource, ILogger logger, CancellationToken cancellationToken) at extractor.Service.Export(ServiceDirectory serviceDirectory, ServiceUri serviceUri, DefaultApiSpecification defaultSpecification, IEnumerable`1 apiNamesToExport, ListRestResources listRestResources, GetRestResource getRestResource, DownloadResource downloadResource, ILogger logger, CancellationToken cancellationToken) at extractor.Extractor.ExportService(CancellationToken cancellationToken) at extractor.Extractor.ExecuteAsync(CancellationToken cancellationToken)Reproduction Steps
Execute the default extractor pipeline on an APIM instance and the task fail will on the Run extractor step.