Could not find stored procedure 'dbo.User_ReadByEmail'

I can’t register any user on my selfhosted bitwarden instance and get this error on the identity container:

fail: Bit.SharedWeb.Utilities.ExceptionHandlerFilterAttribute[0]
      => SpanId:9ff541246cf14a07, TraceId:13b9e05d6b246a408f46561142d83f46, ParentId:0000000000000000 => ConnectionId:0HMOGSG3C0DVJ => RequestPath:/identity/accounts/register RequestId:0HMOGSG3C0DVJ:00000002 => Bit.Identity.Controllers.AccountsController.PostRegister (Identity)
      Could not find stored procedure 'dbo.User_ReadByEmail'.
      Microsoft.Data.SqlClient.SqlException (0x80131904): Could not find stored procedure 'dbo.User_ReadByEmail'.
         at Microsoft.Data.SqlClient.SqlCommand.<>c.<ExecuteDbDataReaderAsync>b__208_0(Task`1 result)
         at System.Threading.Tasks.ContinuationResultTaskFromResultTask`2.InnerInvoke()
         at System.Threading.Tasks.Task.<>c.<.cctor>b__272_0(Object obj)
         at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
      --- End of stack trace from previous location ---
         at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread)
      --- End of stack trace from previous location ---
         at Dapper.SqlMapper.QueryAsync[T](IDbConnection cnn, Type effectiveType, CommandDefinition command) in /_/Dapper/SqlMapper.Async.cs:line 418
         at Bit.Infrastructure.Dapper.Repositories.UserRepository.GetByEmailAsync(String email) in /home/runner/work/server/server/src/Infrastructure.Dapper/Repositories/UserRepository.cs:line 40
         at Bit.Core.Identity.UserStore.FindByEmailAsync(String normalizedEmail, CancellationToken cancellationToken) in /home/runner/work/server/server/src/Core/Identity/UserStore.cs:line 52
         at Bit.Core.Identity.UserStore.FindByNameAsync(String normalizedUserName, CancellationToken cancellationToken) in /home/runner/work/server/server/src/Core/Identity/UserStore.cs:line 76
         at Microsoft.AspNetCore.Identity.UserManager`1.FindByNameAsync(String userName)
         at Microsoft.AspNetCore.Identity.UserValidator`1.ValidateUserName(UserManager`1 manager, TUser user, ICollection`1 errors)
         at Microsoft.AspNetCore.Identity.UserValidator`1.ValidateAsync(UserManager`1 manager, TUser user)
         at Microsoft.AspNetCore.Identity.UserManager`1.ValidateUserAsync(TUser user)
         at Microsoft.AspNetCore.Identity.UserManager`1.CreateAsync(TUser user)
         at Microsoft.AspNetCore.Identity.UserManager`1.CreateAsync(TUser user, String password)
         at Bit.Core.Services.UserService.RegisterUserAsync(User user, String masterPassword, String token, Nullable`1 orgUserId) in /home/runner/work/server/server/src/Core/Services/Implementations/UserService.cs:line 316
         at Bit.Identity.Controllers.AccountsController.PostRegister(RegisterRequestModel model) in /home/runner/work/server/server/src/Identity/Controllers/AccountsController.cs:line 41
         at lambda_method9(Closure , Object )
         at Microsoft.AspNetCore.Mvc.Infrastructure.ActionMethodExecutor.AwaitableObjectResultExecutor.Execute(IActionResultTypeMapper mapper, ObjectMethodExecutor executor, Object controller, Object[] arguments)
         at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeActionMethodAsync>g__Logged|12_1(ControllerActionInvoker invoker)
         at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeNextActionFilterAsync>g__Awaited|10_0(ControllerActionInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
         at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Rethrow(ActionExecutedContextSealed context)
         at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
         at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeInnerFilterAsync>g__Awaited|13_0(ControllerActionInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
         at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeNextExceptionFilterAsync>g__Awaited|26_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
      ClientConnectionId:313b8196-1ba1-490b-9973-9c436abcd0d5
      Error Number:2812,State:62,Class:16

Can someone maybe help me?

Same here, it seems to be missing a lot of stored procedure.
I just installed bitwarden on premises for the first time and after updating it did say

2023.2.0: Pulling from bitwarden/setup
Digest: sha256:eed1aed471ba0fa1bdd47e0d79ab67a58dcd1fc071ffb0014012d5de9ff75077
Status: Image is up to date for bitwarden/setup:2023.2.0
docker.io/bitwarden/setup:2023.2.0

Migrating database.
Migration failed.
Database update complete

also updatedb says the same thing about failing migration (but I’m not migrating anything, it’s a fresh install)

Perhaps it would be similar to this Reddit post?

Experiencing similar issue with a fresh install with container sso 2023.2.0

fail: Microsoft.AspNetCore.Server.Kestrel[13]
Connection id “0HMOHA2O3190V”, Request id “0HMOHA2O3190V:00000002”: An unhandled exception was thrown by the application.
Microsoft.Data.SqlClient.SqlException (0x80131904): Could not find stored procedure ‘dbo.SsoConfig_ReadManyByNotBeforeRevisionDate’.
at Microsoft.Data.SqlClient.SqlCommand.<>c.b__208_0(Task1 result) at System.Threading.Tasks.ContinuationResultTaskFromResultTask2.InnerInvoke()
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)

Also running into the same issue.

Did you open the admin? That should trigger the update scripts.

I fixed it by downgrading to 2023.1.0

Hi

Sorry for the Noob Question,

How to I downgrade/specifiy the version to start?
I’m also running into the same issue on a fresh installation.

Greetings
Thomas

Can you provide me with instructions on how to do this? I posted a question about this issue on Reddit and nobody has responded to it.

I need help fixing this issue. Thanks in advance.

I’m facing the same issue. I spun up two more thinking I was doing something wrong.

There has to be something wrong that’s causing a new install to have an unhealthy sso container.

I hope someone can fix it soon.

Hi Glen,

I worked with the support team on my Issue and we found the root cause. Maybe you are running into the same issue (my sso Container was also unhealthy).

Solution for my case:

You have indeed hit a known bug that we are working on fixing, but not the one you linked; instead, this is the report:

https://github.com/bitwarden/server/issues/2720

In your ./bwdata/env/global.override.env file, please remove the spaces in the ConnectionString for the keywords:

MultipleActiveResultSets

TrustServerCertificate

And then restart Bitwarden:

./bitwarden.sh restart

Hope this helps.

Greetings
Thomas

Awesome!

Fixed my issue too.

Thanks so much!

Glen

1 Like