[BUG] AppService GetSiteInstances Throws Invalid URI error
See original GitHub issueLibrary name and version
Azure.ResourceManager.AppService
Describe the bug
I am trying to get the list of instances from an app services but the SDK is failing when trying to return the list. It throws an Invalid/Empty URI exception.
Additionally, I have tried to get specific instances using known Instance Names, but that also fails with a Null Argument Exception on ‘resourceId’.
Expected behavior
Return list of instances/specific instance
Actual behavior
GetSiteInstances foreach list:
Error: System.UriFormatException: Invalid URI: The URI is empty.
at System.Uri.CreateThis(String uri, Boolean dontEscape, UriKind uriKind, UriCreationOptions& creationOptions)
at System.Uri..ctor(String uriString)
at Azure.ResourceManager.AppService.WebSiteInstanceStatusData.DeserializeWebSiteInstanceStatusData(JsonElement element)
at Azure.ResourceManager.AppService.Models.WebAppInstanceStatusCollection.DeserializeWebAppInstanceStatusCollection(JsonElement element)
at Azure.ResourceManager.AppService.WebAppsRestOperations.ListInstanceIdentifiers(String subscriptionId, String resourceGroupName, String name, CancellationToken cancellationToken)
at Azure.ResourceManager.AppService.SiteInstanceCollection.<>c__DisplayClass8_0.<GetAll>g__FirstPageFunc|0(Nullable`1 pageSizeHint)
at Azure.Core.PageableHelpers.FuncPageable`1.AsPages(String continuationToken, Nullable`1 pageSizeHint)+MoveNext()
at Azure.Pageable`1.GetEnumerator()+MoveNext()
at Submission#63.<<Initialize>>d__0.MoveNext()
--- End of stack trace from previous location ---
at Microsoft.CodeAnalysis.Scripting.ScriptExecutionState.RunSubmissionsAsync[TResult](ImmutableArray`1 precedingExecutors, Func`2 currentExecutor, StrongBox`1 exceptionHolderOpt, Func`2 catchExceptionOpt, CancellationToken cancellationToken)
GetSiteInstanceAsync error:
Error: System.ArgumentNullException: Value cannot be null. (Parameter 'resourceId')
at Azure.Core.Argument.AssertNotNullOrEmpty(String value, String name)
at Azure.Core.ResourceIdentifier..ctor(String resourceId)
at Azure.ResourceManager.AppService.WebSiteInstanceStatusData.DeserializeWebSiteInstanceStatusData(JsonElement element)
at Azure.ResourceManager.AppService.WebAppsRestOperations.GetInstanceInfoAsync(String subscriptionId, String resourceGroupName, String name, String instanceId, CancellationToken cancellationToken)
at Azure.ResourceManager.AppService.SiteInstanceCollection.GetAsync(String instanceId, CancellationToken cancellationToken)
at Azure.ResourceManager.AppService.WebSiteResource.GetSiteInstanceAsync(String instanceId, CancellationToken cancellationToken)
at Submission#66.<<Initialize>>d__0.MoveNext()
--- End of stack trace from previous location ---
at Microsoft.CodeAnalysis.Scripting.ScriptExecutionState.RunSubmissionsAsync[TResult](ImmutableArray`1 precedingExecutors, Func`2 currentExecutor, StrongBox`1 exceptionHolderOpt, Func`2 catchExceptionOpt, CancellationToken cancellationToken)
Reproduction Steps
For multiple instances:
var appService = await resourceGroup.Value.GetWebSiteAsync(appServiceName);
var instances = appService.Value.GetSiteInstances();
foreach(var i in instances)
{
Console.WriteLine($"{i.Data.Name} - {i.Data.State}");
}
Or for a single instance:
var appService = await resourceGroup.Value.GetWebSiteAsync(appServiceName);
var instance = await appService.Value.GetSiteInstanceAsync(instanceName);
Environment
.net 6.0.300
Issue Analytics
- State:
- Created a year ago
- Reactions:2
- Comments:10 (3 by maintainers)
Top Results From Across the Web
[BUG] AppService GetSiteInstances Throws Invalid URI error
This repository is for active development of the Azure SDK for .NET. For consumers of the SDK we recommend visiting our public developer...
Read more >Azure App Service Always On requests invalid URL for ...
We have an app service with multiple custom domains, ... is converted into %C3%A9 by AlwaysOn, which causes an error in the application....
Read more >“AzureADMultipleOrgs” cause 'The URI scheme is invalid ...
Hello, The reason you're getting this error is because for multi-tenant AAD Application Registrations, with a multi-tenant app, the App ID URI ...
Read more >HTTP 500.79 Error / System.UriFormatException when ...
My assumption is, that it is this gibberish URL that causes the UriFormatException, but I've got no clue where the URL is coming...
Read more >Invalid URI: - Common causes and quick fixes
This can be caused by a variety of issues, such as invalid characters, incorrect syntax, or an incorrect port number. To resolve this...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Will be fixed in the next release version
Hi @orck-adrouin. Unfortunately, my role for this issue is just initial triage. I have no insight into its current state. Updates would need to be provided by the assigned engineer, @ArcturusZhang.
//cc: @xboxeer