Hi All! I've managed to get GB set up on AWS, but...
# ask-questions
g
Hi All! I've managed to get GB set up on AWS, but I'm getting "Failed to send email".
docker compose logs
doesn't seem to show anything regarding the error message. Any suggestions on how to debug this?
f
Hi! Did you setup the EMAIL_ environment variables in AWS?
g
Yes, I have them all set
f
and do you have the exact same env with docker compose?
g
I'm running docker on an EC2 host because I just could not get things working in ECS
So I am setting the EMAIL_* settings in my docker-compose.yml
Copy code
- EMAIL_HOST=<http://smtp.gmail.com|smtp.gmail.com>
      - EMAIL_PORT=465
      - EMAIL_HOST_USER=redacted@multimediallc.com
      - EMAIL_HOST_PASSWORD=redacted
      - EMAIL_USE_TLS=true
      - EMAIL_ENABLED=true
f
ok, I see. What email provider are you using?
g
I've also used EMAIL_PORT=587 and tried removing that option as well
I could debug it, but I don't see how to get an actual error message
f
this is when resending an invite?
g
Yes, although presumably the initial send would fail again as well
I just did a new invite and it failed as well
f
Yeah, looks like we're swallowing the error in the back-end for invites.
I checked and the "forgot password" email error does not get swallowed, so if you logout and try resetting your password you should see something in the docker logs
g
Email server not configured
growthbook-growthbook-1  |  | Failed to send reset password email. The reset password link for <mailto:edward@multimediallc.com|edward@multimediallc.com> is:  ...
f
Ah, I see. You are missing the
EMAIL_FROM
environment variable, which is required
We need better error messaging around email configuration
g
Error: Email server not configured\n at /usr/local/src/app/packages/back-end/dist/services/email.js5419\n at Generator.next (<anonymous>)\n at /usr/local/src/app/packages/back-end/dist/services/email.js871\n at new Promise (<anonymous>)\n at __awaiter (/usr/local/src/app/packages/back-end/dist/services/email.js412)\n at sendMail (/usr/local/src/app/packages/back-end/dist/services/email.js5212)\n at Object.<anonymous> (/usr/local/src/app/packages/back-end/dist/services/email.js12015)\n at Generator.next (<anonymous>)\n at /usr/local/src/app/packages/back-end/dist/services/email.js871\n at new Promise (<anonymous>)\n at __awaiter (/usr/local/src/app/packages/back-end/dist/services/email.js412)\n at Object.sendResetPasswordEmail (/usr/local/src/app/packages/back-end/dist/services/email.js11612)\n at Object.<anonymous> (/usr/local/src/app/packages/back-end/dist/models/ForgotPasswordModel.js4927)\n at Generator.next (<anonymous>)\n at fulfilled (/usr/local/src/app/packages/back-end/dist/models/ForgotPasswordModel.js558)","type":"Error","msg":"Email server not configured"}
EMAIL_FROM is not listed as something to configure here: https://docs.growthbook.io/self-host/config
f
Did you set an EMAIL_FROM env variable?
f
OK, we'll update that. This is the code that checks if emails should be enabled.
Copy code
export function isEmailEnabled(): boolean {
  if (!EMAIL_ENABLED) return false;
  if (!EMAIL_HOST) return false;
  if (!EMAIL_PORT) return false;
  if (!EMAIL_HOST_USER) return false;
  if (!EMAIL_HOST_PASSWORD) return false;
  if (!EMAIL_FROM) return false;

  return true;
}
g
Cool, thank you!
Now I'm getting
Invalid login: 535-5.7.8 Username and Password not accepted. Learn more at 535 5.7.8 <https://support.google.com/mail/?p=BadCredentials> u3sm2685671qkj.53 - gsmtp
, which I can work through.... IT has to give me this password so we might have crossed our wires
f
Sorry about the bad docs and missing error messages. I just created a GitHub issue to fix that. https://github.com/growthbook/growthbook/issues/130
g
No sweat! Thanks for helping me get it working!
I was able to resolve my last error by getting an updated password from IT, so email is working now thanks!!
f
Great. We fixed that issue by improving our docs and adding errors when there is a problem sending.