Self hosted Metabase login fails after setup due to smtp

Setup

  1. ec2 running a metabase as docker container
  2. trying to use google smtp and an app password generated on my google gmail account

i recently complted metabase setup and connot login due to the below error is there a way i can bypass this issue



2024-07-01 18:19:40,688 INFO task.refresh-slack-channel-user-cache :: Slack is not configured, not refreshing slack user/channel cache.

2024-07-01 18:28:59,041 INFO driver.impl :: Initializing driver :postgres...

2024-07-01 18:28:59,382 DEBUG middleware.log :: POST /api/session 200 689.7 ms (9 DB calls) App DB connections: 1/4 Jetty threads: 3/50 (4 idle, 0 queued) (38 total active threads) Queries in flight: 0 (0 queued)

2024-07-01 18:28:59,756 DEBUG middleware.log :: GET /api/user/current 401 1.6 ms (0 DB calls)

"Unauthenticated"

2024-07-01 18:28:59,904 INFO i18n.impl :: Reading available locales from locales.clj...

2024-07-01 18:29:00,174 WARN metabase.email :: Failed to send email

javax.mail.AuthenticationFailedException: 535-5.7.8 Username and Password not accepted. For more information, go to

535 5.7.8 https://support.google.com/mail/?p=BadCredentials d75a77b69052e-446514b2484sm33561751cf.81 - gsmtp

at com.sun.mail.smtp.SMTPTransport$Authenticator.authenticate(SMTPTransport.java:947)

at com.sun.mail.smtp.SMTPTransport.authenticate(SMTPTransport.java:858)

at com.sun.mail.smtp.SMTPTransport.protocolConnect(SMTPTransport.java:762)

at javax.mail.Service.connect(Service.java:342)

at postal.smtp$smtp_send_STAR_.invokeStatic(smtp.clj:33)

at postal.smtp$smtp_send_STAR_.invoke(smtp.clj:29)

at postal.smtp$smtp_send.invokeStatic(smtp.clj:58)

at postal.smtp$smtp_send.doInvoke(smtp.clj:39)

at clojure.lang.RestFn.invoke(RestFn.java:423)

at postal.core$send_message.invokeStatic(core.clj:36)

at postal.core$send_message.invoke(core.clj:29)

at metabase.email$fn__75022$send_message_or_throw_BANG___75027$fn__75031.invoke(email.clj:127)

at metabase.email$fn__75022$send_message_or_throw_BANG___75027.invoke(email.clj:119)

at metabase.email$send_message_BANG_.invokeStatic(email.clj:162)

at metabase.email$send_message_BANG_.doInvoke(email.clj:148)

at clojure.lang.RestFn.invoke(RestFn.java:619)

at metabase.email.messages$send_login_from_new_device_email_BANG_.invokeStatic(messages.clj:198)

at metabase.email.messages$send_login_from_new_device_email_BANG_.invoke(messages.clj:184)

at metabase.models.login_history$maybe_send_login_from_new_device_email$fn__75843.invoke(login_history.clj:85)

at clojure.core$binding_conveyor_fn$fn__5823.invoke(core.clj:2047)

at clojure.lang.AFn.call(AFn.java:18)

at java.base/java.util.concurrent.FutureTask.run(Unknown Source)

at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)

at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)

at java.base/java.lang.Thread.run(Unknown Source)

2024-07-01 18:29:00,209 INFO util.fonts :: Reading available fonts from /frontend_client/app/fonts

2024-07-01 18:29:00,223 DEBUG middleware.log :: GET /api/session/properties 200 461.1 ms (2 DB calls) App DB connections: 0/4 Jetty threads: 3/50 (3 idle, 0 queued) (40 total active threads) Queries in flight: 0 (0 queued)

2024-07-01 18:30:38,262 DEBUG middleware.log :: POST /api/session 200 672.2 ms (9 DB calls) App DB connections: 2/4 Jetty threads: 3/50 (4 idle, 0 queued) (38 total active threads) Queries in flight: 0 (0 queued)

2024-07-01 18:30:38,502 WARN metabase.email :: Failed to send email

javax.mail.AuthenticationFailedException: 535-5.7.8 Username and Password not accepted. For more information, go to

535 5.7.8 https://support.google.com/mail/?p=BadCredentials af79cd13be357-79d6930812bsm373504885a.119 - gsmtp

at com.sun.mail.smtp.SMTPTransport$Authenticator.authenticate(SMTPTransport.java:947)

at com.sun.mail.smtp.SMTPTransport.authenticate(SMTPTransport.java:858)

at com.sun.mail.smtp.SMTPTransport.protocolConnect(SMTPTransport.java:762)

at javax.mail.Service.connect(Service.java:342)

at postal.smtp$smtp_send_STAR_.invokeStatic(smtp.clj:33)

at postal.smtp$smtp_send_STAR_.invoke(smtp.clj:29)

at postal.smtp$smtp_send.invokeStatic(smtp.clj:58)

at postal.smtp$smtp_send.doInvoke(smtp.clj:39)

at clojure.lang.RestFn.invoke(RestFn.java:423)

at postal.core$send_message.invokeStatic(core.clj:36)

at postal.core$send_message.invoke(core.clj:29)

at metabase.email$fn__75022$send_message_or_throw_BANG___75027$fn__75031.invoke(email.clj:127)

at metabase.email$fn__75022$send_message_or_throw_BANG___75027.invoke(email.clj:119)

at metabase.email$send_message_BANG_.invokeStatic(email.clj:162)

at metabase.email$send_message_BANG_.doInvoke(email.clj:148)

at clojure.lang.RestFn.invoke(RestFn.java:619)

at metabase.email.messages$send_login_from_new_device_email_BANG_.invokeStatic(messages.clj:198)

at metabase.email.messages$send_login_from_new_device_email_BANG_.invoke(messages.clj:184)

at metabase.models.login_history$maybe_send_login_from_new_device_email$fn__75843.invoke(login_history.clj:85)

at clojure.core$binding_conveyor_fn$fn__5823.invoke(core.clj:2047)

at clojure.lang.AFn.call(AFn.java:18)

at java.base/java.util.concurrent.FutureTask.run(Unknown Source)

at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)

at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)

at java.base/java.lang.Thread.run(Unknown Source)

2024-07-01 18:30:38,622 DEBUG middleware.log :: GET /api/user/current 401 901.4 µs (0 DB calls)

"Unauthenticated"

2024-07-01 18:30:38,742 DEBUG middleware.log :: GET /api/session/properties 200 115.1 ms (1 DB calls) App DB connections: 0/4 Jetty threads: 3/50 (3 idle, 0 queued) (40 total active threads) Queries in flight: 0 (0 queued)

I don't think the SMTP has any bearing here ... What version of metabase are you running? and are you 100% sure the password is correct?

It seems metabase is trying to send an email related to you logging form a new device but it fails. But that is a different issue. I think at least.

And if you disable SMTP via the env variables

Are you able to login with the same user password?

here is the version i am running
**image**: metabase/metabase:v0.46.6.2

i tried using the latest image and it also gave me the same problem .
I am sure the password is correct

the login does not succeed

Can you remove the SMTP setup via env variables above and see what happens ... Also upgrade to 49.18

actioning this now , i'll give you an update in a few minutes

here are the logs : it fails to log me in

metabase    | 2024-07-02 11:51:19,688 DEBUG middleware.log :: POST /api/util/password_check 200 43.3 ms (0 DB calls) App DB connections: 2/10 Jetty threads: 3/50 (4 idle, 0 queued) (48 total active threads) Queries in flight: 0 (0 queued)
metabase    | 2024-07-02 11:51:25,702 DEBUG middleware.log :: HEAD /api/health 200 470.1 µs (0 DB calls) App DB connections: 2/10 Jetty threads: 3/50 (4 idle, 0 queued) (48 total active threads) Queries in flight: 0 (0 queued)
metabase    | 2024-07-02 11:51:35,889 INFO models.user :: Setting User 1's last_acknowledged_version to v0.49.18, the current version
metabase    | 2024-07-02 11:51:35,924 INFO models.user :: Adding User 1 to All Users permissions group...
metabase    | 2024-07-02 11:51:35,925 INFO models.user :: Adding User 1 to All Users permissions group...
metabase    | 2024-07-02 11:51:36,184 DEBUG middleware.log :: POST /api/setup 200 498.9 ms (43 DB calls) App DB connections: 2/10 Jetty threads: 3/50 (8 idle, 0 queued) (54 total active threads) Queries in flight: 0 (0 queued)
metabase    | 2024-07-02 11:51:40,802 DEBUG middleware.log :: HEAD /api/health 200 403.2 µs (0 DB calls) App DB connections: 2/10 Jetty threads: 3/50 (8 idle, 0 queued) (54 total active threads) Queries in flight: 0 (0 queued)
metabase    | 2024-07-02 11:51:40,860 DEBUG middleware.log :: GET /api/user/current 401 288.7 µs (0 DB calls) 
metabase    | "Unauthenticated"
metabase    | 
metabase    | 2024-07-02 11:51:40,893 DEBUG middleware.log :: GET /api/session/properties 200 18.2 ms (1 DB calls) App DB connections: 2/10 Jetty threads: 3/50 (8 idle, 0 queued) (54 total active threads) Queries in flight: 0 (0 queued)
metabase    | 2024-07-02 11:51:44,208 DEBUG middleware.log :: POST /api/session 200 222.6 ms (12 DB calls) App DB connections: 2/10 Jetty threads: 3/50 (8 idle, 0 queued) (54 total active threads) Queries in flight: 0 (0 queued)
metabase    | 2024-07-02 11:51:44,551 DEBUG middleware.log :: GET /api/user/current 401 648.4 µs (0 DB calls) 
metabase    | "Unauthenticated"
metabase    | 
metabase    | 2024-07-02 11:51:44,570 DEBUG middleware.log :: GET /api/session/properties 200 34.8 ms (1 DB calls) App DB connections: 2/10 Jetty threads: 3/50 (7 idle, 0 queued) (54 total active threads) Queries in flight: 0 (0 queued)
metabase    | 2024-07-02 11:51:47,445 DEBUG middleware.log :: POST /api/session 200 290.9 ms (12 DB calls) App DB connections: 2/10 Jetty threads: 3/50 (8 idle, 0 queued) (54 total active threads) Queries in flight: 0 (0 queued)
metabase    | 2024-07-02 11:51:47,789 DEBUG middleware.log :: GET /api/user/current 401 328.9 µs (0 DB calls) 
metabase    | "Unauthenticated"
metabase    | 
metabase    | 2024-07-02 11:51:47,821 DEBUG middleware.log :: GET /api/session/properties 200 18.1 ms (1 DB calls) App DB connections: 2/10 Jetty threads: 3/50 (8 idle, 0 queued) (54 total active threads) Queries in flight: 0 (0 queued)
metabase    | 2024-07-02 11:51:55,909 DEBUG middleware.log :: HEAD /api/health 200 441.2 µs (0 DB calls) App DB connections: 2/10 Jetty threads: 3/50 (8 idle, 0 queued) (54 total active threads) Queries in flight: 0 (0 queued)
metabase    | 2024-07-02 11:52:04,397 DEBUG middleware.log :: POST /api/session 200 192.0 ms (12 DB calls) App DB connections: 2/10 Jetty threads: 3/50 (8 idle, 0 queued) (54 total active threads) Queries in flight: 0 (0 queued)
metabase    | 2024-07-02 11:52:04,703 DEBUG middleware.log :: GET /api/user/current 401 335.7 µs (0 DB calls) 
metabase    | "Unauthenticated"
metabase    | 
metabase    | 2024-07-02 11:52:04,721 DEBUG middleware.log :: GET /api/session/properties 200 28.5 ms (1 DB calls) App DB connections: 2/10 Jetty threads: 3/50 (7 idle, 0 queued) (54 total active threads) Queries in flight: 0 (0 queued)
metabase    | 2024-07-02 11:52:11,015 DEBUG middleware.log :: HEAD /api/health 200 287.1 µs (0 DB calls) App DB connections: 2/10 Jetty threads: 3/50 (8 idle, 0 queued) (54 total active threads) Queries in flight: 0 (0 queued)

So this time the SMTP has nothing to do with it right? ... are you sure the password is correct. Do you have another user to test a login?

1 Like

no i dont have another user this is immediately after setup , so i cannot even access the frontend , i am stuck on the login screen

There is something with your user though ... can you try a new instance (since its already a new instance) and try a simple password see if you login

ok on it , i'll advise in a few minutes

no change at all , is there something at db level that would be blocking this ? i am running an aurora instance as my db

Whats the version? We support both MYSQL and postgres

i am running aurora postgres 15

should work ... if you got to the App DB and go to table core_user are you able to see the password there or its encrypted

yes i can the user there meaning , it's working , so seems there's may be an issue with users model whn trying to authenticate

If you are starting a plain instance of metabase and you are putting test@mail.com and password123 then it should work ... The error in the logs points to "Unauthenticated" which means the username or password are incorrect.

can you share with me a screenshot of that row

ah ok had used my work email , let me change to test@mail.com

That email looks fine to me but yeah lets keep things simple for now... just to figure out what might be happening

1 Like

i will test this and get back in like 20 mins , gotta jump on a call in a bit

let me know!