Timeout when verifying email address

I just installed the Bitwarden server docker images. They seem to be running fine. I can access the web UI and log in. There is a message to please verify my email address. I click the button, but just get the spinner for a while. Then a red message appears for a couple of seconds and then disappears. I was able to capture a screenshot, though:

Here is what I see in the bitwarden-api docker log file:

2023-02-25T02:48:14.735963580Z fail: Bit.Api.Utilities.ExceptionHandlerFilterAttribute[0]
2023-02-25T02:48:14.736087331Z       => SpanId:510da358fc99d5fb, TraceId:a1d45f9de567d074c0375c461ca757dd, ParentId:0000000000000000 => ConnectionId:0HMOMQPEF45M9 => RequestPath:/accounts/verify-email RequestId:0HMOMQPEF45M9:00000002 => Bit.Api.Controllers.AccountsController.PostVerifyEmail (Api)
2023-02-25T02:48:14.736100881Z       The operation has timed out.
2023-02-25T02:48:14.736108251Z       System.TimeoutException: The operation has timed out.
2023-02-25T02:48:14.736371753Z          at MailKit.Net.SocketUtils.ConnectAsync(String host, Int32 port, IPEndPoint localEndPoint, Int32 timeout, Boolean doAsync, CancellationToken cancellationToken)
2023-02-25T02:48:14.736405353Z          at MailKit.MailService.ConnectNetwork(String host, Int32 port, Boolean doAsync, CancellationToken cancellationToken)
2023-02-25T02:48:14.736562554Z          at MailKit.Net.Smtp.SmtpClient.ConnectAsync(String host, Int32 port, SecureSocketOptions options, Boolean doAsync, CancellationToken cancellationToken)
2023-02-25T02:48:14.736845956Z          at Bit.Core.Services.MailKitSmtpMailDeliveryService.SendEmailAsync(MailMessage message) in /home/runner/work/server/server/src/Core/Services/Implementations/MailKitSmtpMailDeliveryService.cs:line 86
2023-02-25T02:48:14.737035529Z          at Bit.Core.Services.HandlebarsMailService.SendVerifyEmailEmailAsync(String email, Guid userId, String token) in /home/runner/work/server/server/src/Core/Services/Implementations/HandlebarsMailService.cs:line 50
2023-02-25T02:48:14.737066999Z          at Bit.Core.Services.UserService.SendEmailVerificationAsync(User user) in /home/runner/work/server/server/src/Core/Services/Implementations/UserService.cs:line 513
2023-02-25T02:48:14.737997076Z          at Bit.Api.Controllers.AccountsController.PostVerifyEmail() in /home/runner/work/server/server/src/Api/Controllers/AccountsController.cs:line 182
2023-02-25T02:48:14.738139727Z          at lambda_method52(Closure , Object )
2023-02-25T02:48:14.738544800Z          at Microsoft.AspNetCore.Mvc.Infrastructure.ActionMethodExecutor.AwaitableResultExecutor.Execute(IActionResultTypeMapper mapper, ObjectMethodExecutor executor, Object controller, Object[] arguments)
2023-02-25T02:48:14.738573860Z          at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeActionMethodAsync>g__Logged|12_1(ControllerActionInvoker invoker)
2023-02-25T02:48:14.738581400Z          at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeNextActionFilterAsync>g__Awaited|10_0(ControllerActionInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
2023-02-25T02:48:14.738805002Z          at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Rethrow(ActionExecutedContextSealed context)
2023-02-25T02:48:14.738845692Z          at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
2023-02-25T02:48:14.738861462Z          at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeInnerFilterAsync>g__Awaited|13_0(ControllerActionInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
2023-02-25T02:48:14.739318046Z          at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeNextExceptionFilterAsync>g__Awaited|26_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)

Here is the global.override.env file. After updating this, I did a REBUILD and a RESTART.

bitwarden@localhost:/opt/bitwarden/bwdata/env$ cat global.override.env 
globalSettings__baseServiceUri__vault=https://bw.danandgeno.com
globalSettings__sqlServer__connectionString="Data Source=tcp:mssql,1433;Initial Catalog=bwvault;Persist Security Info=False;User ID=sa;Password=<REMOVED>;Multiple Active Result Sets=False;Connect Timeout=30;Encrypt=True;Trust Server Certificate=True"
globalSettings__identityServer__certificatePassword=<REMOVED>
globalSettings__internalIdentityKey=<REMOVED>
globalSettings__oidcIdentityClientKey=<REMOVED>
globalSettings__duo__aKey=<REMOVED>
globalSettings__installation__id=<REMOVED>
globalSettings__installation__key=<REMOVED>
globalSettings__yubico__clientId=REPLACE
globalSettings__yubico__key=REPLACE
[email protected]
globalSettings__mail__smtp__host=smtp.gmail.com
globalSettings__mail__smtp__port=587
globalSettings__mail__smtp__ssl=true
[email protected]
globalSettings__mail__smtp__password=<REMOVED>
globalSettings__disableUserRegistration=false
globalSettings__hibpApiKey=REPLACE
[email protected]

Any insight would be a great help. Thanks.

Hi @wallart,

Going off the error being related to verifying email, looking at your SMTP settings it appears you are using a individual user account for sending email with Gmail.
This should be fine and will work, though I would recommend to check and follow the steps detailed by Google.

One thing I would check to verify, if your account (likely does) have MFA set for your Google account. If so you will want to go through the steps to enable and set an App password for Bitwarden that can be used to send SMTP to Gmail.
You would then enter that App Password into your globalSettings__mail__smtp__password=


Though one thing I am curious about, your replyToEmail and smtp__username domains are different, so I am not sure if Gmail allows for sending between alternate domains such as that but after you check the App Password I would try and see if it works :slightly_smiling_face:

P.S. If you have delivery issues you may also check out this article as well.

I am having the same issue when Trying to verify email after setting up account. Only difference is I am not using gmail. I am using an smtp server that I use for all my other verification emails for other services. They always seem to work and it originally worked for me on another Bitwarden server I had set up prior to this one. Any help would be great. Thanks.

image

This is what the API log says after trying to verify email…

2023-05-11 16:44:48.082 +00:00 [Error] The operation has timed out.
System.TimeoutException: The operation has timed out.
at MailKit.Net.SocketUtils.ConnectAsync(String host, Int32 port, IPEndPoint localEndPoint, Int32 timeout, Boolean doAsync, CancellationToken cancellationToken)
at MailKit.MailService.ConnectNetwork(String host, Int32 port, Boolean doAsync, CancellationToken cancellationToken)
at MailKit.Net.Smtp.SmtpClient.ConnectAsync(String host, Int32 port, SecureSocketOptions options, Boolean doAsync, CancellationToken cancellationToken)
at Bit.Core.Services.MailKitSmtpMailDeliveryService.SendEmailAsync(MailMessage message) in /home/runner/work/server/server/src/Core/Services/Implementations/MailKitSmtpMailDeliveryService.cs:line 86
at Bit.Core.Services.HandlebarsMailService.SendVerifyEmailEmailAsync(String email, Guid userId, String token) in /home/runner/work/server/server/src/Core/Services/Implementations/HandlebarsMailService.cs:line 52
at Bit.Core.Services.UserService.SendEmailVerificationAsync(User user) in /home/runner/work/server/server/src/Core/Services/Implementations/UserService.cs:line 510
at Bit.Api.Controllers.AccountsController.PostVerifyEmail() in /home/runner/work/server/server/src/Api/Controllers/AccountsController.cs:line 193
at lambda_method52(Closure , Object )
at Microsoft.AspNetCore.Mvc.Infrastructure.ActionMethodExecutor.AwaitableResultExecutor.Execute(IActionResultTypeMapper mapper, ObjectMethodExecutor executor, Object controller, Object[] arguments)
at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.g__Logged|12_1(ControllerActionInvoker invoker)
at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.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.g__Awaited|13_0(ControllerActionInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.g__Awaited|26_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)