NullReferenceException on AssertDatabaseMatchesConfigurationAsync #2569
Replies: 2 comments
-
Using the postgres database and the postgres user on the server seems to work - are there any special rights that have to be assigned to the user apart from making them the db owner? |
Beta Was this translation helpful? Give feedback.
-
@haarhoff-frs If you're creating the database upfront and don't need Marten to apply patches at runtime, I'd recommend setting your That will disable any database migration checking. And to your real question, does your user need "special rights", yes. Marten will need permissions to select and view the postgres metadata. The crappy part is that it won't fail cleanly if you don't have access, it'll just give you empty data. I think that's what happened to you, but in the past that's been a silent failure where Marten just can't detect the current state of the DB. I'm not exactly sure what's happening or what part of the table metadata is missing. Looking at the Weasel code, the only thing that jumps out at me as a possible NRE is if the "id" column is missing in the DB, but no idea how that would happen. I'm moving this to a discussion for now. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi,
I'm currently trying to deploy my first little ASP.NET Core test-project that uses marten.
Its Marten 5.11.0 with Npgsql 6.0.9 in an ASP.NET Core project using .NET 7. I'm using the latest PostgreSQL 14 server.
Locally everything works just fine, but when deployed to my Ubuntu 22.04 server, I get the following error:
The local and prod database are created the same way, by generating a SQL file with
marten-dump
and then running that against the database. The only obvious difference is that locally it runs under the postgres user, while in prod I have a separate user, which owns the database and schema.All types are precreated using
codegen write
.This is the database configuration:
Any help or nudge in the right direction would be greatly appreciated :)
Beta Was this translation helpful? Give feedback.
All reactions