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

Postgres authentication failure leads to null ref exception #2670

Closed
arildboifot opened this issue Aug 4, 2023 · 2 comments · Fixed by #2689
Closed

Postgres authentication failure leads to null ref exception #2670

arildboifot opened this issue Aug 4, 2023 · 2 comments · Fixed by #2689

Comments

@arildboifot
Copy link

Minimal repro:

var store = DocumentStore.For("****");
var session = store.LightweightSession();
var result = await session.QueryAsync<int>("select count(*) from mt_doc_foo");
Console.WriteLine($"Count: {result.First()}");

This leads to the following stack trace:

Unhandled exception. System.NullReferenceException: Object reference not set to an instance of an object.
   at Marten.Exceptions.MartenCommandException..ctor(NpgsqlCommand command, Exception innerException)
   at Marten.Exceptions.MartenExceptionTransformer.<>c.<.cctor>b__1_2(NpgsqlException e)
   at JasperFx.Core.Exceptions.ExceptionTransform`1.TryTransform(Exception original, Exception& transformed)
   at JasperFx.Core.Exceptions.ExceptionTransformExtensions.TransformAndThrow(IEnumerable`1 transforms, Exception ex)
   at JasperFx.Core.Exceptions.ExceptionTransforms.TransformAndThrow(Exception ex)
   at Marten.Exceptions.MartenExceptionTransformer.WrapAndThrow(Exception exception)
   at Marten.Linq.MartenLinqQueryProvider.ExecuteHandlerAsync[T](IQueryHandler`1 handler, CancellationToken token)
   at Marten.Internal.Sessions.QuerySession.QueryAsync[T](String sql, CancellationToken token, Object[] parameters)
   at Program.<Main>$(String[] args) in /Users/arild/dev/gamefraym/MartenDOTest/ConsoleApp1/Program.cs:line 34
   at Program.<Main>(String[] args)
@GKotfis
Copy link
Contributor

GKotfis commented Aug 18, 2023

The same happening when DB is inaccessible because of network problems etc. At first, I thought that something was wrong with my document schema. It turns out that docker with Postgres was not running.

@oskardudycz
Copy link
Collaborator

It should be fixed in 6.1 release by #2689.

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

Successfully merging a pull request may close this issue.

3 participants