AFFiNE icon indicating copy to clipboard operation
AFFiNE copied to clipboard

​Error: Mailer service is not configured - Email is not working even after adding the details

Open arsaboo opened this issue 1 year ago • 3 comments

What happened?

I have added all the email related information in the environmental variables:

AFFINE_ADMIN_EMAIL=AFFINE_EMAIL
AFFINE_ADMIN_PASSWORD=AFFINE_PASSWORD
MAILER_HOST=smtp.gmail.com
MAILER_PORT=465
[email protected]
MAILER_PASSWORD=PASSWORD
[email protected]
MAILER_SECURE=true
SERVER_FLAVOR=selfhosted

Yet, I am unable to send emails. When I request a reset link, for example, I see the following toast message:

image

Distribution version

macOS ARM 64 (Apple Silicon)

What browsers are you seeing the problem on if you're using web version?

Chrome

Are you self-hosting?

  • [X] Yes

Relevant log output

[Nest] 197  - 05/13/2024, 12:12:19 PM   ERROR [GQLLoggerPlugin] GraphQL Unhandled Error
Error: Mailer service is not configured.
    at MailService.sendMail (file:///app/dist/fundamentals/mailer/mail.service.js:26:19)
    at MailService.sendChangePasswordEmail (file:///app/dist/fundamentals/mailer/mail.service.js:112:21)
    at AuthService.sendChangePasswordEmail (file:///app/dist/core/auth/service.js:331:28)
    at AuthResolver.sendChangePasswordEmail (file:///app/dist/core/auth/resolver.js:95:37)

arsaboo avatar May 13 '24 12:05 arsaboo

Issue Status: 🆕 *Untriaged

*🆕 Untriaged

The team has not yet reviewed the issue. We usually do it within one business day. Docs: https://github.com/toeverything/AFFiNE/blob/canary/docs/issue-triaging.md

This is an automatic reply by the bot.

affine-issue-bot[bot] avatar May 13 '24 12:05 affine-issue-bot[bot]

Same issue here 🙏

Log output

members.tsx:138 Uncaught (in promise) 
[GraphQLError: Failed to send invite email. Please try again.
    at https://REDAC…]
0: GraphQLError: Failed to send invite email. Please try again. at https://REDACTED/js/app-e92b52cc.js:46:619117 at Array.map (<anonymous>) at https://REDACTED/js/app-e92b52cc.js:46:619110 at async T (https://REDACTED/js/chunk.npm-async-swr-0e9e1b78.js:1:2817) at async https://REDACTED/js/chunk.npm-async-swr-0e9e1b78.js:1:25043 at async https:/REDACTED/js/chunk.8249-1593f1b3.js:1699:34077 at async https://REDACTED/js/chunk.8249-1593f1b3.js:1699:34542
extensions: {code: 500, status: 'INTERNAL_SERVER_ERROR'}
locations: undefined
message: "Failed to send invite email. Please try again."
path: ['invite']
name: "GraphQLError"

(anonymous)	@	members.tsx:138 await in (anonymous) (async)
(anonymous)	@	invite-modal.tsx:34
(anonymous)	@	confirm-modal.tsx:

Debian 12 Bookworm, AMD64, Affine version 0.14.6

Worked fine in 0.13.4, but after the upgrade it's broken and my clients are waiting to be onboarded 😅

Edit: Potentially related, I get the same error when I try to click on Send verification link, when I want to change my account's email.

Log output

affine-async-hooks.ts:10 Array(1)0: GraphQLError: Internal Server Error
    at https://REDACTED/js/app-e92b52cc.js:46:619117
    at Array.map (<anonymous>)
    at https://REDACTED/js/app-e92b52cc.js:46:619110
    at async T (https://REDACTED/js/chunk.npm-async-swr-0e9e1b78.js:1:2817)
    at async https://REDACTED/js/chunk.npm-async-swr-0e9e1b78.js:1:25043
    at async https://REDACTED/js/chunk.3679-1c72a808.js:1:11556
extensions:
    code: 500
    status: "INTERNAL_SERVER_ERROR"
locations: undefined
message: "Internal Server Error"
path: ['sendChangeEmail']
name: "GraphQLError"

Edit 2: It isn't working even with env. variables added to Docker Compose @paulsp94 👍

Wraithers avatar May 15 '24 00:05 Wraithers

I had to feed in the env variables over the docker compose additionally

affine:
    image: ghcr.io/toeverything/affine-graphql:stable
    container_name: affine_selfhosted
    command:
      ['sh', '-c', 'node ./scripts/self-host-predeploy && node ./dist/index.js']
    ports:
      - '3010:3010'
      - '5555:5555'
    depends_on:
      redis:
        condition: service_healthy
      postgres:
        condition: service_healthy
    volumes:
      # custom configurations
      - ~/.affine/self-host/config:/root/.affine/config
      # blob storage
      - ~/.affine/self-host/storage:/root/.affine/storage
    logging:
      driver: 'json-file'
      options:
        max-size: '1000m'
    restart: unless-stopped
    environment:
      - NODE_OPTIONS="--import=./scripts/register.js"
      - AFFINE_CONFIG_PATH=/root/.affine/config
      - REDIS_SERVER_HOST=redis
      - DATABASE_URL=postgres://affine:affine@postgres:5432/affine
      - NODE_ENV=production
      - AFFINE_ADMIN_EMAIL=${AFFINE_ADMIN_EMAIL}
      - AFFINE_ADMIN_PASSWORD=${AFFINE_ADMIN_PASSWORD}
      - MAILER_HOST=${MAILER_HOST}
      - MAILER_PORT=${MAILER_PORT}
      - MAILER_USER=${MAILER_USER}
      - MAILER_PASSWORD=${MAILER_PASSWORD}
      - MAILER_SENDER=${MAILER_SENDER}

paulsp94 avatar May 15 '24 11:05 paulsp94

@paulsp94 Thanks....that worked.

arsaboo avatar May 15 '24 19:05 arsaboo