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
OnTenantNotResolved #628
Comments
Hi, for (1) I plan to build in support for this, but for now the easiest method is to place a simple middleware right after the app.Use(async (context, next) =>
}); For (2) I'm not sure, I'll need to test that. I would want it to raise in that situation. |
🎉 This issue has been resolved in version 6.13.0 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
This change broke my code and I was the original contributor of the OnTenantNotResolved haha. Now it seems to be firing way too early? @AndrewTriesToCode Actually what seems to be happening is its no longer respecting IgnoredIdentifiers before that OnTenantNotResolved event fires. Which is odd because I don't see anything in the commit. But between 6.12 and 6.13 that broke. |
Hi @natelaff glad to hear from you. The change in implementation here was intended to fire the not found event if no tenant identifier was found -- prior it was only firing this event if an identifier was found but no tenant resolved from store. I'll take a closer look when I can but feel free to submit any fixes as you see fit. Maybe a distinction between identifier found but no tenant resolved and no identifier found would make sense but I still think the primary use case in general is tenant not found -- either way. Of course it should also respect explicitly ignore identifiers. |
@AndrewTriesToCode i haven't had time to wrap my head around the change. I looked at it, but it looks like that event system changed even a little bit since I submitted it. But to me, the purpose of the TenantNotFound event was it identified there was a tenant (unless explicitly ignored by identifiers) but couldn't find it in the store. Seems to me routing or whatever other pattern you're using should take care of the tenant identifier null, and not this event. Kind of seems like someone shoe horned this in and broke its original intent. |
I’m leaning toward a |
Not being in the group of people that experienced this issue, it's hard to say. Granted, that event was added by me for a very specific purpose so it always just worked for me haha -- until now. From my understanding of the issue that influenced this change, it's almost like they want TenantIdentifierNotFound event? Not even TenantInfo, because info would be resolved past that point? Seems like they want this to trigger earlier than that? EDIT: Ah, yes we're thinking the exact same thing! |
Hi Andrew, After reading through this, the current implementation of "OnTenantNotResolved" checks if there is an identifier found based on your strategy(s). You are considering reverting "OnTenantNotResolved" to its original implementation, which fires if a tenant is not found in the tenant store(s). You are considering creating another event, possibly "TenantIdentifierNotFound", that that implements the current logic found in "OnTenantNotResolved"? If so, I think this would be a nice addition to the Finbuckle. |
Thanks guys. I'll work up a PR soon. Working on getting the new options functionality out first, then this. |
Hi,
I'm using your library in a ASP.NET Core project.
This is the configuration:
I've two questions:
How I can return a 404 response when a tenant is not resolved instead to throw an exception? I think that OnTenantNotResolved should be a func in
Task<T>
so I could return anIActionResult
.I tried with this solution Exceptions logged using OnTenantNotResolved #554 but don't work because the line
Task.CompleteTask
don't interrupt the execution of the code and I receive this exceptionUnable to resolve service for type 'Finbuckle.MultiTenant.ITenantInfo' while attempting to activate
when i use the dependency injection in my controllerpublic MyController(IHttpClientFactory httpClientFactory, ITenantInfo tenantInfo)
Why when the header "x-tenant-id" is missing the event OnTenantNotResolved don't raise? Seems the strategy is ignored. Is right?
Thanks!
The text was updated successfully, but these errors were encountered: