server
server copied to clipboard
Organization domain maintenance failed because of untranslated query
Steps To Reproduce
- Deploy docker/self-host:v2024.1.2
- Create organization with user (maybe not required - unsure)
Other steps may be required, but I am unsure how to trigger Organization Domain Maintenance.
Expected Result
No errors in admin.log
Actual Result
Error in admin.log:
fail: Bit.Core.Services.OrganizationDomainService[0]
Organization domain maintenance failed
System.InvalidOperationException: The LINQ expression 'DbSet<OrganizationDomain>()
.Where(o => (DateTime.UtcNow - o.CreationDate).Days == 4 && o.VerifiedDate == null)' could not be translated. Either rewrite the query in a form that can be translated, or switch to client evaluation explicitly by inserting a call to 'AsEnumerable', 'AsAsyncEnumerable', 'ToList', or 'ToListAsync'. See https://go.microsoft.com/fwlink/?linkid=2101038 for more information.
at Microsoft.EntityFrameworkCore.Query.QueryableMethodTranslatingExpressionVisitor.<VisitMethodCall>g__CheckTranslated|15_0(ShapedQueryExpression translated, <>c__DisplayClass15_0& )
at Microsoft.EntityFrameworkCore.Query.QueryableMethodTranslatingExpressionVisitor.VisitMethodCall(MethodCallExpression methodCallExpression)
at Microsoft.EntityFrameworkCore.Query.RelationalQueryableMethodTranslatingExpressionVisitor.VisitMethodCall(MethodCallExpression methodCallExpression)
at Microsoft.EntityFrameworkCore.Query.QueryCompilationContext.CreateQueryExecutor[TResult](Expression query)
at Microsoft.EntityFrameworkCore.Storage.Database.CompileQuery[TResult](Expression query, Boolean async)
at Microsoft.EntityFrameworkCore.Query.Internal.QueryCompiler.CompileQueryCore[TResult](IDatabase database, Expression query, IModel model, Boolean async)
at Microsoft.EntityFrameworkCore.Query.Internal.QueryCompiler.<>c__DisplayClass12_0`1.<ExecuteAsync>b__0()
at Microsoft.EntityFrameworkCore.Query.Internal.CompiledQueryCache.GetOrAddQuery[TResult](Object cacheKey, Func`1 compiler)
at Microsoft.EntityFrameworkCore.Query.Internal.QueryCompiler.ExecuteAsync[TResult](Expression query, CancellationToken cancellationToken)
at Microsoft.EntityFrameworkCore.Query.Internal.EntityQueryProvider.ExecuteAsync[TResult](Expression expression, CancellationToken cancellationToken)
at Microsoft.EntityFrameworkCore.Query.Internal.EntityQueryable`1.GetAsyncEnumerator(CancellationToken cancellationToken)
at System.Runtime.CompilerServices.ConfiguredCancelableAsyncEnumerable`1.GetAsyncEnumerator()
at Microsoft.EntityFrameworkCore.EntityFrameworkQueryableExtensions.ToListAsync[TSource](IQueryable`1 source, CancellationToken cancellationToken)
at Bit.Infrastructure.EntityFramework.Repositories.OrganizationDomainRepository.GetExpiredOrganizationDomainsAsync() in /source/src/Infrastructure.EntityFramework/Repositories/OrganizationDomainRepository.cs:line 126
at Bit.Core.Services.OrganizationDomainService.OrganizationDomainMaintenanceAsync() in /source/src/Core/Services/Implementations/OrganizationDomainService.cs:line 101
Screenshots or Videos
No response
Additional Context
Appears to have been reported a few months ago: #3416
Githash Version
dca8d00
Environment Details
Docker
Database Image
mariadb:11
Issue-Link
https://github.com/bitwarden/server/issues/2480
Issue Tracking Info
- [X] I understand that work is tracked outside of Github. A PR will be linked to this issue should one be opened to address it, but Bitwarden doesn't use fields like "assigned", "milestone", or "project" to track progress.
@Greenderella I have cleared the logs once but the issue came back; it appears to be intermittent - as I said, I am unsure when organization domain maintenance is triggered. Regardless, it is clear the query is not being translated by EF correctly for MySQL/mariadb and that should probably be resolved.