You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello,
I seem to be encountering an weird error with using Multi-Tenancy when using WithClaimStrategy.
My project is a Blazor web app, with client-side rendering with rest api backend and am using MultiTenantIdentityDbContext for the identity db context along with my own dbsets.
I have created a user that has the claim sentry_tenant with the value default, and logged in.
When I try to reach an endpoint, I can see in the logs that the tenant is picked up correctly by multi-tenant:
dbug: Finbuckle.MultiTenant.AspNetCore.Strategies.ClaimStrategy[0]
GetIdentifierAsync: Found identifier: "default"
dbug: Finbuckle.MultiTenant.Stores.InMemoryStore.InMemoryStore[0]
TryGetByIdentifierAsync: Tenant found with identifier "default"
But once it starts executing the code inside the action, EFCore will throw an error:
Anunhandled exception has occurred while executing the request.
System.NullReferenceException: Object reference not set to an instance of an object.
at lambda_method142(Closure,QueryContext)
at Microsoft.EntityFrameworkCore.Query.Internal.QueryCompiler.ExecuteAsync[TResult](Expressionquery,CancellationTokencancellationToken)
at Microsoft.EntityFrameworkCore.Query.Internal.EntityQueryProvider.ExecuteAsync[TResult](Expressionexpression,CancellationTokencancellationToken)
at Microsoft.EntityFrameworkCore.Query.Internal.EntityQueryable`1.GetAsyncEnumerator(CancellationTokencancellationToken)
at Microsoft.EntityFrameworkCore.Internal.InternalDbSet`1.System.Collections.Generic.IAsyncEnumerable<TEntity>.GetAsyncEnumerator(CancellationTokencancellationToken)
at System.Runtime.CompilerServices.ConfiguredCancelableAsyncEnumerable`1.GetAsyncEnumerator()
at Microsoft.EntityFrameworkCore.EntityFrameworkQueryableExtensions.ToListAsync[TSource](IQueryable`1source,CancellationTokencancellationToken)
........
However,
If I comment out the WithClaimStrategy or give it a fake authentication scheme as the 2nd parameter (so it falls back onto the static) it will pull the exact same default tenant from the static strategy. and call the same endpoint, it works without errors.
Im confused 😅
The text was updated successfully, but these errors were encountered:
Hello,
I seem to be encountering an weird error with using Multi-Tenancy when using
WithClaimStrategy
.My project is a Blazor web app, with client-side rendering with rest api backend and am using
MultiTenantIdentityDbContext
for the identity db context along with my own dbsets.DbContext:
SentryUser
&,SentryRole
both have the the[MultiTenant]
attribute.Multi Tenant:
I have created a user that has the claim
sentry_tenant
with the valuedefault
, and logged in.When I try to reach an endpoint, I can see in the logs that the tenant is picked up correctly by multi-tenant:
But once it starts executing the code inside the action, EFCore will throw an error:
However,
If I comment out the
WithClaimStrategy
or give it a fake authentication scheme as the 2nd parameter (so it falls back onto the static) it will pull the exact samedefault
tenant from the static strategy. and call the same endpoint, it works without errors.Im confused 😅
The text was updated successfully, but these errors were encountered: