Closed
Description
Describe the bug
CosmosDB client tries to obtain VM info which only exists when running the service on Azure VMs
Either:
- Automatically detect it and don't try to send a request
- Offer a way to disable this handler when running the client in a different environment (e.g. locally)
Scope: HttpMethod:GET Uri:http://169.254.169.254/metadata/instance?api-version=2020-06-01 {OriginalFormat}:HTTP {HttpMethod} {Uri}
2023-11-15 15:07:07.241 (err ) GET 169.254.169.254//metadata/instance
0: Exception: Connection refused (169.254.169.254:80) (System.Net.Http.HttpRequestException)
at System.Net.Http.HttpConnectionPool.ConnectToTcpHostAsync(String host, Int32 port, HttpRequestMessage initialRequest, Boolean async, CancellationToken cancellationToken)
at System.Net.Http.HttpConnectionPool.ConnectAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken)
at System.Net.Http.HttpConnectionPool.CreateHttp11ConnectionAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken)
at System.Net.Http.HttpConnectionPool.AddHttp11ConnectionAsync(HttpRequestMessage request)
at System.Threading.Tasks.TaskCompletionSourceWithCancellation`1.WaitWithCancellationAsync(CancellationToken cancellationToken)
at System.Net.Http.HttpConnectionPool.GetHttp11ConnectionAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken)
at System.Net.Http.HttpConnectionPool.SendWithVersionDetectionAndRetryAsync(HttpRequestMessage request, Boolean async, Boolean doRequestAuth, CancellationToken cancellationToken)
at System.Net.Http.RedirectHandler.SendAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken)
at Microsoft.Extensions.Http.Logging.LoggingHttpMessageHandler.SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)
at Microsoft.R9.Extensions.HttpClient.Logging.Internal.HttpLoggingHandler.SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)
0:0: Exception: Connection refused (System.Net.Sockets.SocketException)
at System.Net.Sockets.Socket.AwaitableSocketAsyncEventArgs.ThrowException(SocketError error, CancellationToken cancellationToken)
at System.Net.Sockets.Socket.AwaitableSocketAsyncEventArgs.System.Threading.Tasks.Sources.IValueTaskSource.GetResult(Int16 token)
at System.Net.Sockets.Socket.<ConnectAsync>g__WaitForConnectWithCancellation|277_0(AwaitableSocketAsyncEventArgs saea, ValueTask connectTask, CancellationToken cancellationToken)
at System.Net.Http.HttpConnectionPool.ConnectToTcpHostAsync(String host, Int32 port, HttpRequestMessage initialRequest, Boolean async, CancellationToken cancellationToken)
To Reproduce
Steps to reproduce the behavior. If you can include code snippets or links to repositories containing a repro of the issue that can helps us in detecting the scenario it would speed up the resolution.
Run an app with CosmosDB client enabled and log configured outside of Azure
Expected behavior
Either:
- Automatically detect it and don't try to send a request
- Offer a way to disable this handler when running the client in a different environment (e.g. locally)
Actual behavior
Exception is thrown in the logs
Environment summary
SDK Version: 3.33.0
OS Version (e.g. Windows, Linux, MacOSX) macOS 14.1.1 (23B81)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment