Any good resources/Discord servers (to discuss with other devs) for troubleshooting user login/email verification issues?

I have a self-hosted instance and was able to make the admin user, but when trying to create a new test user, the user does not get the verification email.

I assume its related to this issue because I see the same issue but on login rather than sign up: https://github.com/LemmyNet/lemmy-ui/issues/1080

I am able to create the new user but get no email verification and then when I try to login the login button gets stuck with the spinner. No frontend console logs so I assume something is dying server-side and not bubbling the error.

Really just looking for some guidance/links to docs on how I can access logs to troubleshoot server-side errors (and my gut tells me maybe an email issue but I am a novice in this space so not sure).

Any help is appreciated.

Thank you.

  • pineapple@lemmy.pineapplemachine.com
    link
    fedilink
    arrow-up
    3
    ·
    edit-2
    1 year ago

    If email isn’t working, then you’ll have to turn off email verification in your instance’s settings before anyone is able to log in without encountering that spinner.

    To get email to work, you’ll need to provide SMTP credentials in lemmy.hjson on the server you’re using to host lemmy. An example SMTP configuration is shown in the docs here: https://join-lemmy.org/docs/en/administration/configuration.html

    You may also have to restart lemmy after you update the configuration, in order for it to take effect. (I do this on my server via docker-compose restart.)

    When I set up lemmy on my server with lemmy-ansible, the config file was initially set up with a valid-looking SMTP config. But when emails weren’t working I looked more closely, and it turned out that there is something broken with the SMTP service that lemmy is integrated with by default. It seems that you will need to provide your own credentials.

    I’m using an SMTP service provided by a web hosting service I pay for, but you can also use gmail in a pinch: https://kinsta.com/blog/gmail-smtp-server/

    • Slashzero
      link
      fedilink
      arrow-up
      3
      ·
      1 year ago

      Does the gmail SMTP server have a limit on how many emails can be sent per day?

      • pineapple@lemmy.pineapplemachine.com
        link
        fedilink
        arrow-up
        4
        ·
        1 year ago

        Does the gmail SMTP server have a limit on how many emails can be sent per day?

        I think it does, yes. The kinsta.com link says the limit is 500 per day. If you’re expecting a higher volume than that, or if the unpredictability of relying on a free Google service for anything is not acceptable, then you would probably want to pay for an inbox service.

        But if you’re running a small instance and just need the occasional email to go through without a lot of effort or fees, then it ought to be fine.

        • Slashzero@hakbox.social
          link
          fedilink
          arrow-up
          3
          ·
          edit-2
          1 year ago

          I’m still using my own install of postfix for now, and emails seem to be going through fine, although they end up in the spam folder sometimes.

          I signed up for the free tier of brevo.com, and could not get it working, but I think it was due to a networking issue in the base docker install for the lemmy front end, where it is only on the internal network and can’t make outgoing calls? Everything outgoing from the lemmy instance was timing out.

          Now that I fixed that (by adding a second network interface to the lemmy container,) I might try to switch back to the brevo relay and creds and see if that works. 300 per day (that won’t get bounced or go directly into SPAM is not bad.)


          UPDATE

          I switched my config back to brevo, now that I fixed the “internal only network” issue for lemmy on my instance, and emails are going through the relay. I bet they would also work with GoDaddy’s office365 relay now. The issue was the networking issue where the lemmy frontend couldn’t make outgoing calls.

  • MrWiggles@prime8s.xyz
    link
    fedilink
    arrow-up
    3
    ·
    1 year ago

    You’re probably best off submitting an issue on github, but note that depending on how you have SMTP configured and how you’re sending mail- you may be having issues with your hosting provider, mine blocks the SMTP ports. I’m currently working to get mail set up, but its very difficult. I’ll keep you posted.

    • Slashzero
      link
      fedilink
      arrow-up
      4
      ·
      1 year ago

      I spent the last few hours trying to get mail working on my instance. Eventually I set up postfix on my linux host and had the lemmy docker container use that. Happy to say it is working.

      https://lemmy.ml/post/1185795

      • MrWiggles@prime8s.xyz
        link
        fedilink
        arrow-up
        2
        ·
        1 year ago

        Glad to hear that, I recently just got mail working as well. I ended up using an smtp relay service. Did you have any issues with getting your emails rejected? I might switch as this service is quite expensive.

        • Slashzero@hakbox.social
          link
          fedilink
          arrow-up
          2
          ·
          1 year ago

          I went as far as to use my site’s certs in postfix so at least the e-mails wouldn’t be outright rejected by gmail, but I haven’t seen one go through yet. I still have quite a bit of testing to do with gmail to see if they are eventually going through.

          I haven’t see any being rejected by yahoo mail at all, but they do end up in the SPAM folder.

          I think I had some network issues preventing me from using an external relay, so I might try bravo again, if anyone actually uses my instance and emails become an issue.

  • Admiral Patrick@dubvee.org
    link
    fedilink
    English
    arrow-up
    3
    ·
    1 year ago

    How did you set up Lemmy? If you used Docker, you can get them from docker logs. For a native install, I’m unclear on where the logs get written or if they go through syslog; perhaps someone else can chime in.

    If you’re using docker, try this:

    Enter your Lemmy directory and run:

    docker-compose logs --tail=10 -f lemmy

    where lemmy is the name of the container running the lemmy backend (not the ui). With the logs tail-ing, try your registration process and look for any errors.

    The logs are fairly easy to parse visually, which is nice because there are quite a few backend errors that do not pop up in the UI. Keeping the logs tail-ing for the first day or so was really helpful in getting my instance up and running.

    For what it’s worth, I’ve got email verification set up and working on my instance. I had some issues at first, but I had two problems, both of which gave me endless spinners in the UI:

    1. At first, I forgot to add the email settings to lemmy’s config.hjson file (d’oh!)
    2. I was using the SSL port for my SMTP server but forgot to set the tls_type to tls.

    If the backend has any issue connecting to the email server, it should show up in the logs.

    • OdiousStoogeOP
      link
      fedilink
      English
      arrow-up
      2
      ·
      1 year ago

      Nice! Thanks your mention of the config.hjson makes me wonder lol. I probably goofed that too.

      I did the ansible install which I believe just adds orchestration on top of the Docker install. I’ll ssh in and try the docker-compose command.

      Do you know, if I did goof the email config, can I just tweak the config locally and then re-run ansible? Or do I need to do some manual tweaks to the deployed solution? Or I suppose at this point it might be easier to just blow the instance away and start fresh.

      • majorswitcher@lemmyfly.org
        link
        fedilink
        English
        arrow-up
        2
        ·
        1 year ago

        where are you running your environment ? I’m on DigitalOcean for example since last night, found out this morning that digitalocean blocks smtp port 25 to prevent being used for spammers. when checking the logs, also check the postfix container, that’s the email server. if that reads it can’t connect you probably have the same issue. see this thread for setting up sendgrid as a relay to your postfix mail server

      • Admiral Patrick@dubvee.org
        link
        fedilink
        English
        arrow-up
        2
        ·
        1 year ago

        I’m not clear on the ansible install, but if it’s just a layer on top of the docker deployment, you should be able to find the config file, edit it, and restart the container for the Lemmy back end.

        I think that will work for testing, but I don’t know if that will get wiped out if you ever redeploy from ansible.

        • OdiousStoogeOP
          link
          fedilink
          English
          arrow-up
          2
          ·
          1 year ago

          Cool thanks! Last thing for now, and then I’ll go do some debugging.

          Dumb Q: The lemmy install includes an SMTP server correct? Like I don’t need to use an external service for that?

          • Admiral Patrick@dubvee.org
            link
            fedilink
            English
            arrow-up
            3
            ·
            1 year ago

            No, it doesn’t. You’ll need an SMTP server to plug into it. You can use any that you want, though, including Gmail, etc. Just plug in the relevant details. That will vary from provider to provider, but they all generally have setup instructions for email clients such as Thunderbird, Outlook, etc. The relevant portions of those guides are the “outgoing” configurations.

            This post talks about running Postfix locally/alongside Lemmy and using Postfix to relay through SendGrid. Lemmy sends to postfix and postfix relays through SendGrid.