[GH-ISSUE #5934] [bug]: Error from sendEmail: TypeError: Cannot read properties of undefined (reading 'sendMail') #2331

Open
opened 2026-03-16 23:59:22 +03:00 by kerem · 3 comments
Owner

Originally created by @carenswijaya01 on GitHub (Mar 4, 2026).
Original GitHub issue: https://github.com/hoppscotch/hoppscotch/issues/5934

Originally assigned to: @mirarifhasan on GitHub.

Is there an existing issue for this?

  • I have searched existing issues and this bug hasn't been reported yet

Platform

Web App

Browser

Chrome

Operating System

Linux

Bug Description

I tried to upgrade from hoppscotch 2025.10.1 to 2026.2.0. Previously i'm able to send email for user / admin login. Now when i'm upgrading to latest version, i got error like this

Backend Server | Error from sendEmail: TypeError: Cannot read properties of undefined (reading 'sendMail')
Backend Server |     at MailerService.sendEmail (/dist/backend/dist/src/mailer/mailer.service.js:40:42)
Backend Server |     at AuthService.signInMagicLink (/dist/backend/dist/src/auth/auth.service.js:196:34)
Backend Server |     at process.processTicksAndRejections (node:internal/process/task_queues:105:5)
Backend Server |     at async AuthController.signInMagicLink (/dist/backend/dist/src/auth/auth.controller.js:83:31)
Backend Server | [Nest] 62  - 03/04/2026, 6:18:05 AM   ERROR [ExceptionsHandler] Error: email/failed
Backend Server |     at throwErr (/dist/backend/dist/src/utils.js:68:11)
Backend Server |     at MailerService.sendEmail (/dist/backend/dist/src/mailer/mailer.service.js:49:41)
Backend Server |     at AuthService.signInMagicLink (/dist/backend/dist/src/auth/auth.service.js:196:34)
Backend Server |     at process.processTicksAndRejections (node:internal/process/task_queues:105:5)
Backend Server |     at async AuthController.signInMagicLink (/dist/backend/dist/src/auth/auth.controller.js:83:31)

and after i tried to log, console.log(this.nestMailerService) in mailer.service.js and i got 'undefined' for that log

this is my docker compose setup from portainer

services:
  hoppscotch-aio:
    container_name: hoppscotch-aio
    restart: always
    image: hoppscotch/hoppscotch:latest
    env_file:
      - stack.env
    depends_on:
      hoppscotch-db:
        condition: service_healthy
    ports:
      - "8001:80"
    command: >
      sh -c "pnpm exec prisma migrate deploy && node /usr/src/app/aio_run.mjs"
    networks:
      - net
  hoppscotch-db:
    image: postgres:15
    container_name: hoppscotch-db
    restart: always
    environment:
      POSTGRES_USER: postgres
      POSTGRES_PASSWORD: ****
      POSTGRES_DB: hoppscotch
    healthcheck:
      test:
        [
          "CMD-SHELL",
          "sh -c 'pg_isready -U $${POSTGRES_USER} -d $${POSTGRES_DB}'",
        ]
      interval: 5s
      timeout: 5s
      retries: 10
    volumes:
      - ./hoppscotch-db:/var/lib/postgresql/data
    networks:
      - net

networks:
  net:
    name: server-net
    external: true

And this is my env

HOPP_AIO_ALTERNATE_PORT=80
DATABASE_URL=postgresql://postgres:***@hoppscotch-db:5432/hoppscotch?connect_timeout=300
JWT_SECRET=***
TOKEN_SALT_COMPLEXITY=10
MAGIC_LINK_TOKEN_VALIDITY=3
REFRESH_TOKEN_VALIDITY=604800000
ACCESS_TOKEN_VALIDITY=86400000
SESSION_SECRET=***
ALLOW_SECURE_COOKIES=true
DATA_ENCRYPTION_KEY=***
HOPPSCOTCH_HOST=192.168.18.52:8001
REDIRECT_URL=http://$HOPPSCOTCH_HOST
WHITELISTED_ORIGINS=http://localhost:3170,http://localhost:3000,http://localhost:3100,app://localhost_3200,app://hoppscotch,http://$HOPPSCOTCH_HOST,app://$HOPPSCOTCH_HOST,http://192_168_18_52_8001,app://192_168_18_52_8001,http://localhost:8001
RATE_LIMIT_TTL=60
RATE_LIMIT_MAX=100
VITE_ALLOWED_AUTH_PROVIDERS=EMAIL
VITE_BASE_URL=http://192.168.18.52:8001
VITE_SHORTCODE_BASE_URL=http://192.168.18.52:8001
VITE_ADMIN_URL=http://192.168.18.52:8001/admin
VITE_BACKEND_GQL_URL=http://192.168.18.52:8001/backend/graphql
VITE_BACKEND_WS_URL=ws://192.168.18.52:8001/backend/graphql
VITE_BACKEND_API_URL=http://192.168.18.52:8001/backend/v1
VITE_APP_TOS_LINK=http://docs.hoppscotch.io/support/terms
VITE_APP_PRIVACY_POLICY_LINK=http://docs.hoppscotch.io/support/privacy
ENABLE_SUBPATH_BASED_ACCESS=true
MAILER_SMTP_ENABLE="true"
MAILER_USE_CUSTOM_CONFIGS="true"
MAILER_ADDRESS_FROM="noreply@mydomain.com"
MAILER_SMTP_HOST="192.168.*.*"
MAILER_SMTP_PORT="587"
MAILER_SMTP_SECURE="false"
MAILER_SMTP_USER="***"
MAILER_SMTP_PASSWORD="***"
MAILER_TLS_REJECT_UNAUTHORIZED="false"

I dont know if it just misconfigure or something, but if i tried previous version like 2025.11.2 i still get the same error, but if i use 2025.10.1 it works but my collection become untitled, maybe because downgrading issue

Deployment Type

Self-hosted (on-prem deployment)

Version

2026.2.0

Originally created by @carenswijaya01 on GitHub (Mar 4, 2026). Original GitHub issue: https://github.com/hoppscotch/hoppscotch/issues/5934 Originally assigned to: @mirarifhasan on GitHub. ### Is there an existing issue for this? - [x] I have searched existing issues and this bug hasn't been reported yet ### Platform Web App ### Browser Chrome ### Operating System Linux ### Bug Description I tried to upgrade from hoppscotch 2025.10.1 to 2026.2.0. Previously i'm able to send email for user / admin login. Now when i'm upgrading to latest version, i got error like this ``` Backend Server | Error from sendEmail: TypeError: Cannot read properties of undefined (reading 'sendMail') Backend Server | at MailerService.sendEmail (/dist/backend/dist/src/mailer/mailer.service.js:40:42) Backend Server | at AuthService.signInMagicLink (/dist/backend/dist/src/auth/auth.service.js:196:34) Backend Server | at process.processTicksAndRejections (node:internal/process/task_queues:105:5) Backend Server | at async AuthController.signInMagicLink (/dist/backend/dist/src/auth/auth.controller.js:83:31) Backend Server | [Nest] 62 - 03/04/2026, 6:18:05 AM ERROR [ExceptionsHandler] Error: email/failed Backend Server | at throwErr (/dist/backend/dist/src/utils.js:68:11) Backend Server | at MailerService.sendEmail (/dist/backend/dist/src/mailer/mailer.service.js:49:41) Backend Server | at AuthService.signInMagicLink (/dist/backend/dist/src/auth/auth.service.js:196:34) Backend Server | at process.processTicksAndRejections (node:internal/process/task_queues:105:5) Backend Server | at async AuthController.signInMagicLink (/dist/backend/dist/src/auth/auth.controller.js:83:31) ``` and after i tried to log, console.log(this.nestMailerService) in mailer.service.js and i got 'undefined' for that log this is my docker compose setup from portainer ``` services: hoppscotch-aio: container_name: hoppscotch-aio restart: always image: hoppscotch/hoppscotch:latest env_file: - stack.env depends_on: hoppscotch-db: condition: service_healthy ports: - "8001:80" command: > sh -c "pnpm exec prisma migrate deploy && node /usr/src/app/aio_run.mjs" networks: - net hoppscotch-db: image: postgres:15 container_name: hoppscotch-db restart: always environment: POSTGRES_USER: postgres POSTGRES_PASSWORD: **** POSTGRES_DB: hoppscotch healthcheck: test: [ "CMD-SHELL", "sh -c 'pg_isready -U $${POSTGRES_USER} -d $${POSTGRES_DB}'", ] interval: 5s timeout: 5s retries: 10 volumes: - ./hoppscotch-db:/var/lib/postgresql/data networks: - net networks: net: name: server-net external: true ``` And this is my env ``` HOPP_AIO_ALTERNATE_PORT=80 DATABASE_URL=postgresql://postgres:***@hoppscotch-db:5432/hoppscotch?connect_timeout=300 JWT_SECRET=*** TOKEN_SALT_COMPLEXITY=10 MAGIC_LINK_TOKEN_VALIDITY=3 REFRESH_TOKEN_VALIDITY=604800000 ACCESS_TOKEN_VALIDITY=86400000 SESSION_SECRET=*** ALLOW_SECURE_COOKIES=true DATA_ENCRYPTION_KEY=*** HOPPSCOTCH_HOST=192.168.18.52:8001 REDIRECT_URL=http://$HOPPSCOTCH_HOST WHITELISTED_ORIGINS=http://localhost:3170,http://localhost:3000,http://localhost:3100,app://localhost_3200,app://hoppscotch,http://$HOPPSCOTCH_HOST,app://$HOPPSCOTCH_HOST,http://192_168_18_52_8001,app://192_168_18_52_8001,http://localhost:8001 RATE_LIMIT_TTL=60 RATE_LIMIT_MAX=100 VITE_ALLOWED_AUTH_PROVIDERS=EMAIL VITE_BASE_URL=http://192.168.18.52:8001 VITE_SHORTCODE_BASE_URL=http://192.168.18.52:8001 VITE_ADMIN_URL=http://192.168.18.52:8001/admin VITE_BACKEND_GQL_URL=http://192.168.18.52:8001/backend/graphql VITE_BACKEND_WS_URL=ws://192.168.18.52:8001/backend/graphql VITE_BACKEND_API_URL=http://192.168.18.52:8001/backend/v1 VITE_APP_TOS_LINK=http://docs.hoppscotch.io/support/terms VITE_APP_PRIVACY_POLICY_LINK=http://docs.hoppscotch.io/support/privacy ENABLE_SUBPATH_BASED_ACCESS=true MAILER_SMTP_ENABLE="true" MAILER_USE_CUSTOM_CONFIGS="true" MAILER_ADDRESS_FROM="noreply@mydomain.com" MAILER_SMTP_HOST="192.168.*.*" MAILER_SMTP_PORT="587" MAILER_SMTP_SECURE="false" MAILER_SMTP_USER="***" MAILER_SMTP_PASSWORD="***" MAILER_TLS_REJECT_UNAUTHORIZED="false" ``` I dont know if it just misconfigure or something, but if i tried previous version like 2025.11.2 i still get the same error, but if i use 2025.10.1 it works but my collection become untitled, maybe because downgrading issue ### Deployment Type Self-hosted (on-prem deployment) ### Version 2026.2.0
Author
Owner

@carenswijaya01 commented on GitHub (Mar 4, 2026):

i tried restarting the container and it worked (2026.2.0), but when i tried to restart it again, it didn’t work anymore till now and got same error and same log (undefined)

<!-- gh-comment-id:3995772679 --> @carenswijaya01 commented on GitHub (Mar 4, 2026): i tried restarting the container and it worked (2026.2.0), but when i tried to restart it again, it didn’t work anymore till now and got same error and same log (undefined)
Author
Owner

@carenswijaya01 commented on GitHub (Mar 6, 2026):

i just notice when i restart again, when building the nest app, i got error

Backend Server | Error from loadInfraConfiguration Error: Connection terminated due to connection timeout
Backend Server |     at /dist/backend/node_modules/.pnpm/pg-pool@3.11.0_pg@8.18.0/node_modules/pg-pool/index.js:45:11
Backend Server |     at process.processTicksAndRejections (node:internal/process/task_queues:103:5)
Backend Server |     at async PrismaPgAdapter.performIO (/dist/backend/node_modules/.pnpm/@prisma+adapter-pg@7.4.2/node_modules/@prisma/adapter-pg/dist/index.js:652:22)
Backend Server |     at async PrismaPgAdapter.queryRaw (/dist/backend/node_modules/.pnpm/@prisma+adapter-pg@7.4.2/node_modules/@prisma/adapter-pg/dist/index.js:602:30)
Backend Server |     at async e.interpretNode (/dist/backend/node_modules/.pnpm/@prisma+client@7.4.2_prisma@7.4.2_@types+react@19.2.6_react-dom@19.2.0_react@19.2.0__re_65f7b5bc2cc68017807e1f198ffccdae/node_modules/@prisma/client/runtime/client.js:11:44517)
Backend Server |     at async e.interpretNode (/dist/backend/node_modules/.pnpm/@prisma+client@7.4.2_prisma@7.4.2_@types+react@19.2.6_react-dom@19.2.0_react@19.2.0__re_65f7b5bc2cc68017807e1f198ffccdae/node_modules/@prisma/client/runtime/client.js:11:46181)
Backend Server |     at async e.run (/dist/backend/node_modules/.pnpm/@prisma+client@7.4.2_prisma@7.4.2_@types+react@19.2.6_react-dom@19.2.0_react@19.2.0__re_65f7b5bc2cc68017807e1f198ffccdae/node_modules/@prisma/client/runtime/client.js:11:43231)
Backend Server |     at async e.execute (/dist/backend/node_modules/.pnpm/@prisma+client@7.4.2_prisma@7.4.2_@types+react@19.2.6_react-dom@19.2.0_react@19.2.0__re_65f7b5bc2cc68017807e1f198ffccdae/node_modules/@prisma/client/runtime/client.js:57:815)
Backend Server |     at async jt.request (/dist/backend/node_modules/.pnpm/@prisma+client@7.4.2_prisma@7.4.2_@types+react@19.2.6_react-dom@19.2.0_react@19.2.0__re_65f7b5bc2cc68017807e1f198ffccdae/node_modules/@prisma/client/runtime/client.js:58:2327)
Backend Server |     at async Object.singleLoader (/dist/backend/node_modules/.pnpm/@prisma+client@7.4.2_prisma@7.4.2_@types+react@19.2.6_react-dom@19.2.0_react@19.2.0__re_65f7b5bc2cc68017807e1f198ffccdae/node_modules/@prisma/client/runtime/client.js:65:6569) {
Backend Server |   clientVersion: '7.4.2',
Backend Server |   [cause]: Error: Connection terminated unexpectedly
Backend Server |       at Connection.<anonymous> (/dist/backend/node_modules/.pnpm/pg@8.18.0/node_modules/pg/lib/client.js:177:73)
Backend Server |       at Object.onceWrapper (node:events:622:28)
Backend Server |       at Connection.emit (node:events:508:28)
Backend Server |       at Socket.<anonymous> (/dist/backend/node_modules/.pnpm/pg@8.18.0/node_modules/pg/lib/connection.js:61:12)
Backend Server |       at Socket.emit (node:events:508:28)
Backend Server |       at TCP.<anonymous> (node:net:346:12)
Backend Server | }
Backend Server | Mailer module is disabled

maybe because mailer module is disabled? how to re run it without restarting docker?

<!-- gh-comment-id:4009601025 --> @carenswijaya01 commented on GitHub (Mar 6, 2026): i just notice when i restart again, when building the nest app, i got error ``` Backend Server | Error from loadInfraConfiguration Error: Connection terminated due to connection timeout Backend Server | at /dist/backend/node_modules/.pnpm/pg-pool@3.11.0_pg@8.18.0/node_modules/pg-pool/index.js:45:11 Backend Server | at process.processTicksAndRejections (node:internal/process/task_queues:103:5) Backend Server | at async PrismaPgAdapter.performIO (/dist/backend/node_modules/.pnpm/@prisma+adapter-pg@7.4.2/node_modules/@prisma/adapter-pg/dist/index.js:652:22) Backend Server | at async PrismaPgAdapter.queryRaw (/dist/backend/node_modules/.pnpm/@prisma+adapter-pg@7.4.2/node_modules/@prisma/adapter-pg/dist/index.js:602:30) Backend Server | at async e.interpretNode (/dist/backend/node_modules/.pnpm/@prisma+client@7.4.2_prisma@7.4.2_@types+react@19.2.6_react-dom@19.2.0_react@19.2.0__re_65f7b5bc2cc68017807e1f198ffccdae/node_modules/@prisma/client/runtime/client.js:11:44517) Backend Server | at async e.interpretNode (/dist/backend/node_modules/.pnpm/@prisma+client@7.4.2_prisma@7.4.2_@types+react@19.2.6_react-dom@19.2.0_react@19.2.0__re_65f7b5bc2cc68017807e1f198ffccdae/node_modules/@prisma/client/runtime/client.js:11:46181) Backend Server | at async e.run (/dist/backend/node_modules/.pnpm/@prisma+client@7.4.2_prisma@7.4.2_@types+react@19.2.6_react-dom@19.2.0_react@19.2.0__re_65f7b5bc2cc68017807e1f198ffccdae/node_modules/@prisma/client/runtime/client.js:11:43231) Backend Server | at async e.execute (/dist/backend/node_modules/.pnpm/@prisma+client@7.4.2_prisma@7.4.2_@types+react@19.2.6_react-dom@19.2.0_react@19.2.0__re_65f7b5bc2cc68017807e1f198ffccdae/node_modules/@prisma/client/runtime/client.js:57:815) Backend Server | at async jt.request (/dist/backend/node_modules/.pnpm/@prisma+client@7.4.2_prisma@7.4.2_@types+react@19.2.6_react-dom@19.2.0_react@19.2.0__re_65f7b5bc2cc68017807e1f198ffccdae/node_modules/@prisma/client/runtime/client.js:58:2327) Backend Server | at async Object.singleLoader (/dist/backend/node_modules/.pnpm/@prisma+client@7.4.2_prisma@7.4.2_@types+react@19.2.6_react-dom@19.2.0_react@19.2.0__re_65f7b5bc2cc68017807e1f198ffccdae/node_modules/@prisma/client/runtime/client.js:65:6569) { Backend Server | clientVersion: '7.4.2', Backend Server | [cause]: Error: Connection terminated unexpectedly Backend Server | at Connection.<anonymous> (/dist/backend/node_modules/.pnpm/pg@8.18.0/node_modules/pg/lib/client.js:177:73) Backend Server | at Object.onceWrapper (node:events:622:28) Backend Server | at Connection.emit (node:events:508:28) Backend Server | at Socket.<anonymous> (/dist/backend/node_modules/.pnpm/pg@8.18.0/node_modules/pg/lib/connection.js:61:12) Backend Server | at Socket.emit (node:events:508:28) Backend Server | at TCP.<anonymous> (node:net:346:12) Backend Server | } Backend Server | Mailer module is disabled ``` maybe because mailer module is disabled? how to re run it without restarting docker?
Author
Owner

@carenswijaya01 commented on GitHub (Mar 6, 2026):

yep, i think it's because mailer module is disabled. Here's the little trick i do, but i hope it fixed later

  1. docker compose up hoppscotch-db -d
  2. waiting for a few seconds
  3. docker compose up hoppsotch-aio -d
  4. docker compose logs -f
  5. check the logs, if still error then try to restart until success: docker compose restart hoppscotch-aio -d

and the logs should be like this, then my email works

hoppscotch-aio  | Webapp Server | 2026/03/06 05:51:49 Server starting on :3200
hoppscotch-aio  | Backend Server | [Nest] 40  - 03/06/2026, 5:51:51 AM     LOG [NestFactory] Starting Nest application...
hoppscotch-aio  | Backend Server | Using advanced mailer configuration
hoppscotch-aio  | Backend Server | [Nest] 40  - 03/06/2026, 5:51:53 AM     LOG [InstanceLoader] PrismaModule dependencies initialized +1573ms
hoppscotch-aio  | Backend Server | [Nest] 40  - 03/06/2026, 5:51:53 AM     LOG [InstanceLoader] PubSubModule dependencies initialized +1ms
hoppscotch-aio  | Backend Server | [Nest] 40  - 03/06/2026, 5:51:53 AM     LOG [InstanceLoader] MailerModule dependencies initialized +0ms
hoppscotch-aio  | Backend Server | [Nest] 40  - 03/06/2026, 5:51:53 AM     LOG [InstanceLoader] PassportModule dependencies initialized +0ms

Using advanced mailer configuration part is what i looking for

<!-- gh-comment-id:4009779429 --> @carenswijaya01 commented on GitHub (Mar 6, 2026): yep, i think it's because mailer module is disabled. Here's the little trick i do, but i hope it fixed later 1. docker compose up hoppscotch-db -d 2. waiting for a few seconds 3. docker compose up hoppsotch-aio -d 4. docker compose logs -f 5. check the logs, if still error then try to restart until success: docker compose restart hoppscotch-aio -d and the logs should be like this, then my email works ``` hoppscotch-aio | Webapp Server | 2026/03/06 05:51:49 Server starting on :3200 hoppscotch-aio | Backend Server | [Nest] 40 - 03/06/2026, 5:51:51 AM LOG [NestFactory] Starting Nest application... hoppscotch-aio | Backend Server | Using advanced mailer configuration hoppscotch-aio | Backend Server | [Nest] 40 - 03/06/2026, 5:51:53 AM LOG [InstanceLoader] PrismaModule dependencies initialized +1573ms hoppscotch-aio | Backend Server | [Nest] 40 - 03/06/2026, 5:51:53 AM LOG [InstanceLoader] PubSubModule dependencies initialized +1ms hoppscotch-aio | Backend Server | [Nest] 40 - 03/06/2026, 5:51:53 AM LOG [InstanceLoader] MailerModule dependencies initialized +0ms hoppscotch-aio | Backend Server | [Nest] 40 - 03/06/2026, 5:51:53 AM LOG [InstanceLoader] PassportModule dependencies initialized +0ms ``` **Using advanced mailer configuration** part is what i looking for
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/hoppscotch#2331
No description provided.