question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[BUG] AppService GetSiteInstances Throws Invalid URI error

See original GitHub issue

Library 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:closed
  • Created a year ago
  • Reactions:2
  • Comments:10 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
live1206commented, Jun 27, 2023

Will be fixed in the next release version

1reaction
jsquirecommented, Jan 25, 2023

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

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found