Skip to content

Please add meaningful error message for bad credentials #8510

Closed
@ecrocombe

Description

@ecrocombe

Elastic.Clients.Elasticsearch version: 8.17.1, also tested on 9.0.1, same thing.

Elasticsearch version: 8.17.1

.NET runtime version: 9.0.1

Operating system version: ubuntu x64 (24.04? LTS)

Description of the problem including expected versus actual behavior:
Originally published issue at https://discuss.elastic.co/t/nre-on-elasticsearchclient/377820

Exception message and trace is not very useful to diagnose an incorrect api key.

Expected behavior
An Exception message like "Authentication Failed" or something.

Actual behavior

System.NullReferenceException: Object reference not set to an instance of an object.
   at Elastic.Transport.DistributedTransport`1.RequestCoreAsync[TResponse](Boolean isAsync, EndpointPath path, PostData data, Action`1 configureActivity, IRequestConfiguration localConfiguration, CancellationToken cancellationToken)
   at Elastic.Clients.Elasticsearch.ElasticsearchClient.<>c__DisplayClass865_0`3.<<DoRequestCoreAsync>g__SendRequestWithProductCheckCore|2>d.MoveNext() in /_/src/Elastic.Clients.Elasticsearch/_Shared/Client/ElasticsearchClient.cs:line 221
--- End of stack trace from previous location ---
   at Elastic.Clients.Elasticsearch.ElasticsearchClient.<>c__DisplayClass865_0`3.<<DoRequestCoreAsync>g__SendRequestWithProductCheck|1>d.MoveNext() in /_/src/Elastic.Clients.Elasticsearch/_Shared/Client/ElasticsearchClient.cs:line 180
--- End of stack trace from previous location ---
   at Rust.Domain.Infrastructure.Searching.SearchProvider.HealthyAsync(CancellationToken cancellationToken) in /src/src/Rust.Domain/Infrastructure/Searching/SearchProvider.cs:line 21
   at Rust.GameserverIndexer.GameserverIndexer.EnsureIndexRebuiltAsync(CancellationToken cancellationToken) in /src/src/Rust.GameserverIndexer/GameserverIndexer.cs:line 64
   at Rust.GameserverIndexer.GameserverIndexer.EnsureIndexRebuiltAsync(CancellationToken cancellationToken) in /src/src/Rust.GameserverIndexer/GameserverIndexer.cs:line 67
   at Rust.GameserverIndexer.GameserverIndexer.ExecuteAsync(CancellationToken stoppingToken) in /src/src/Rust.GameserverIndexer/GameserverIndexer.cs:line 39
   at Microsoft.Extensions.Hosting.Internal.Host.TryExecuteBackgroundServiceAsync(BackgroundService backgroundService)

Metadata

Metadata

Assignees

No one assigned

    Labels

    8.xRelates to a 8.x client version9.xRelates to a 9.x client versionCategory: Bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions