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

AzureAppConfiguration Options.Select Errors on Multiple Segment Wildcards #222

Open
HashTagDotNet opened this issue Dec 12, 2019 · 3 comments
Assignees
Labels

Comments

@HashTagDotNet
Copy link

Microsoft.Extensions.Configuration.AzureAppConfiguration, Version=3.0.0.0, Culture=neutral,

When I use a '*' wild card in any AzureAppConfigurationOptions.Select() with multiple comma delimited segments, I get an error.

options.Select("dummy-selector,dummy-selector","\0");  // (succeeds) no wild cards, multiple 

options.Select("dummy-Selector*","\0");  // (succeeds) wild card, single segment

options.Select("dummy-selector*,dummy-selector-2","\0"); // (fails) wild card as first in series 

options.Select("dummy-selector,dummy-selector-2*","\0"); // (fails) wild card as second in series

Request

GET /kv/?key=dummy-selector%2A%2Cdummy-selector-2&label=%00&api-version=1.0 HTTP/1.1
Host: ******
Accept: application/vnd.microsoft.appconfig.kv+json
Correlation-Context: RequestType=Startup,Host=IISExpress
x-ms-client-request-id: 917cf1cd-ac63-4981-b892-f9d9594bc30a
x-ms-return-client-request-id: true
User-Agent: Microsoft.Extensions.Configuration.AzureAppConfiguration/3.0.0.0 azsdk-net-Data.AppConfiguration/1.0.0-preview.5+244f59a4499e01fdee834c397b4457f1442200bd,(.NET Core 3.1.0; Microsoft Windows 10.0.18362)
x-ms-content-sha256: 47DEQpj8HBSa+/TImW+5JCeuQeRkm5NMpJWZG3hSuFU=
Date: Thu, 12 Dec 2019 17:36:44 GMT
Authorization:  **************
Sync-Token: zAJw6V16=MDotMSM3MDE3NjA=
Request-Id: |650c9af-4b83518de9196c35.1.

Response

Azure.RequestFailedException: Service request failed.
Status: 400 (Bad Request)

Content:
{"type":"https://azconfig.io/errors/invalid-argument","title":"Invalid request parameter 'key'","name":"key","detail":"key(14): Invalid character","pos":14,"status":400}

Headers:
Server: openresty/1.15.8.1
Date: Thu, 12 Dec 2019 17:25:30 GMT
Transfer-Encoding: chunked
Connection: keep-alive
x-ms-request-id: 763a6d2b-2500-40e7-a1f3-04199b77ae1f
x-ms-client-request-id: 7f073d35-ffec-494c-adf2-e2e08562fe10
x-ms-correlation-request-id: 763a6d2b-2500-40e7-a1f3-04199b77ae1f
Access-Control-Allow-Origin: *
Access-Control-Allow-Credentials: true
Access-Control-Allow-Methods: GET, PUT, POST, DELETE, PATCH, OPTIONS
Access-Control-Allow-Headers: DNT, X-CustomHeader, Keep-Alive, User-Agent, X-Requested-With, If-Modified-Since, Cache-Control, Content-Type, Authorization, x-ms-client-request-id, x-ms-content-sha256, x-ms-date, host, Accept, Accept-Datetime, Date, If-Match, If-None-Match, Sync-Token, x-ms-return-client-request-id, ETag, Last-Modified, Link, Memento-Datetime, x-ms-retry-after, x-ms-request-id, WWW-Authenticate
Access-Control-Expose-Headers: DNT, X-CustomHeader, Keep-Alive, User-Agent, X-Requested-With, If-Modified-Since, Cache-Control, Content-Type, Authorization, x-ms-client-request-id, x-ms-content-sha256, x-ms-date, host, Accept, Accept-Datetime, Date, If-Match, If-None-Match, Sync-Token, x-ms-return-client-request-id, ETag, Last-Modified, Link, Memento-Datetime, x-ms-retry-after, x-ms-request-id, WWW-Authenticate
Strict-Transport-Security: max-age=15724800; includeSubDomains
Content-Type: application/vnd.microsoft.appconfig.kv+json; charset=utf-8

   at Azure.Data.AppConfiguration.ConfigurationClient.GetConfigurationSettingsPageAsync(SettingSelector selector, String pageLink, CancellationToken cancellationToken)
   at Azure.Core.PageResponseEnumerator.FuncAsyncPageable`1.AsPages(String continuationToken, Nullable`1 pageSizeHint)+MoveNext()
   at Azure.Core.PageResponseEnumerator.FuncAsyncPageable`1.AsPages(String continuationToken, Nullable`1 pageSizeHint)+System.Threading.Tasks.Sources.IValueTaskSource<System.Boolean>.GetResult()
   at Azure.AsyncPageable`1.GetAsyncEnumerator(CancellationToken cancellationToken)+MoveNext()
   at Azure.AsyncPageable`1.GetAsyncEnumerator(CancellationToken cancellationToken)+MoveNext()
   at Azure.AsyncPageable`1.GetAsyncEnumerator(CancellationToken cancellationToken)+System.Threading.Tasks.Sources.IValueTaskSource<System.Boolean>.GetResult()
   at Microsoft.Extensions.Configuration.AzureAppConfiguration.AzureAppConfigurationProvider.<>c__DisplayClass14_3.<<LoadAll>b__4>d.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at Microsoft.Extensions.Configuration.AzureAppConfiguration.AzureAppConfigurationProvider.<>c__DisplayClass14_3.<<LoadAll>b__4>d.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at Microsoft.Extensions.Configuration.AzureAppConfiguration.TracingUtils.CallWithRequestTracing(Boolean tracingEnabled, RequestType requestType, HostType hostType, Func`1 clientCall)
   at Microsoft.Extensions.Configuration.AzureAppConfiguration.AzureAppConfigurationProvider.CallWithRequestTracing(Func`1 clientCall)
   at Microsoft.Extensions.Configuration.AzureAppConfiguration.AzureAppConfigurationProvider.LoadAll()
   at Microsoft.Extensions.Configuration.AzureAppConfiguration.AzureAppConfigurationProvider.Load()
   at Microsoft.Extensions.Configuration.ConfigurationRoot..ctor(IList`1 providers)
   at Microsoft.Extensions.Configuration.ConfigurationBuilder.Build()
   at Microsoft.Extensions.Hosting.HostBuilder.BuildAppConfiguration()
   at Microsoft.Extensions.Hosting.HostBuilder.Build()

Work Around

Use separate options.Select() statements for each wild card selector. This work around results in separate calls to Azure for each options.Select() definition.

@zhenlan
Copy link
Contributor

zhenlan commented Dec 12, 2019

Hi @HashTagDotNet similar to #212, this is by design. Using wildcard and comma together is not a supported filter. We, however, need improvement of the documentation for easier discovery of this information.

https://github.com/Azure/AppConfiguration/blob/master/docs/REST/kv.md#filtering

@zhenlan zhenlan added the docs label Dec 12, 2019
@zhenlan zhenlan self-assigned this Dec 12, 2019
@HashTagDotNet
Copy link
Author

HashTagDotNet commented Dec 12, 2019 via email

@zhenlan
Copy link
Contributor

zhenlan commented Dec 12, 2019

Thanks for the suggestion @HashTagDotNet. We will consider it.

The pricing plan can be found at Azure/AppConfiguration-Announcements#2. The filtering support could be enriched in the future. The config provider library is making necessary calls based on what is currently supported by the REST API.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants