[GH-ISSUE #3257] [bug]: Self hosted email send(for sending magic link) failed #1082

Open
opened 2026-03-16 18:25:35 +03:00 by kerem · 53 comments
Owner

Originally created by @giripradip on GitHub (Aug 16, 2023).
Original GitHub issue: https://github.com/hoppscotch/hoppscotch/issues/3257

Is there an existing issue for this?

  • I have searched the existing issues

Current behavior

The continue with email and sending the magic links fails with error on both admin and in hoppscotch app.

I have setup the environment variable like following:
MAILER_SMTP_URL="smtps://noreply@mydomain.com:password@mail.mydomain.com"
MAILER_ADDRESS_FROM='"From mycompany Hoppscotch" noreply@mydomain.com'

I even tried with MailCatcher like explained in this tutorial.
MAILER_SMTP_URL="smtp://host.docker.internal:1025"
MAILER_ADDRESS_FROM='"From my company Hoppscotch" noreply@mydomain.com'
I can see the MailCatcher ui running on 1080 port.

But I got following issue on hoppscotch admin app:
https://hoppapi.mydomain.com/v1/auth/signin?origin=admin 500 (Internal Server Error)
Error: Request failed with status code 500
at tu (index.8d42fd3d.js:67:8560)
at nu (index.8d42fd3d.js:67:8743)
at XMLHttpRequest.m (index.8d42fd3d.js:68:16
{"statusCode":500,"message":"Internal server error"}

The docker container shows the following:
[Nest] 19 - 08/16/2023, 9:31:18 AM ERROR [ExceptionsHandler] email/failed
hoppscotch-backend | Error: email/failed
hoppscotch-backend | at throwErr (/usr/src/app/dist/utils.js:13:11)
hoppscotch-backend | at MailerService.sendEmail (/usr/src/app/dist/mailer/mailer.service.js:39:41)
hoppscotch-backend | at async AuthService.signInMagicLink (/usr/src/app/dist/auth/auth.service.js:153:9)
hoppscotch-backend | at async AuthController.signInMagicLink (/usr/src/app/dist/auth/auth.controller.js:36:31)
hoppscotch-backend | at async /usr/src/app/node_modules/.pnpm/@nestjs+core@9.2.1_@nestjs+common@9.2.1_@nestjs+platform-express@9.2.1_reflect-metadata@0.1.13_rxjs@7.6.0/node_modules/@nestjs/core/router/router-execution-context.js:46:28
hoppscotch-backend | at async /usr/src/app/node_modules/.pnpm/@nestjs+core@9.2.1_@nestjs+common@9.2.1_@nestjs+platform-express@9.2.1_reflect-metadata@0.1.13_rxjs@7.6.0/node_modules/@nestjs/core/router/router-proxy.js:9:17

I am using Alma Linux 9. Please let me know if I need to make any settings related to server or If I am missing something.

Steps to reproduce

  1. Go to hoppscotch admin app.
  2. Click continue with email button
  3. Input your email
  4. Click send the magic link button

For hoppscotch app

  1. Click login
  2. Continue with email
  3. Input your email
  4. Send magic link

Environment

Production

Version

Self-hosted

Originally created by @giripradip on GitHub (Aug 16, 2023). Original GitHub issue: https://github.com/hoppscotch/hoppscotch/issues/3257 ### Is there an existing issue for this? - [X] I have searched the existing issues ### Current behavior The **continue with email** and sending the magic links fails with error on both admin and in hoppscotch app. I have setup the environment variable like following: MAILER_SMTP_URL="smtps://noreply@mydomain.com:password@mail.mydomain.com" MAILER_ADDRESS_FROM='"From mycompany Hoppscotch" <noreply@mydomain.com>' I even tried with MailCatcher like explained in [this](https://medium.com/@kiranjohns/self-host-your-api-testing-with-hoppscotch-the-open-source-api-platform-cbe8b62d3c54) tutorial. MAILER_SMTP_URL="smtp://host.docker.internal:1025" MAILER_ADDRESS_FROM='"From my company Hoppscotch" <noreply@mydomain.com>' I can see the MailCatcher ui running on 1080 port. But I got following issue on hoppscotch admin app: https://hoppapi.mydomain.com/v1/auth/signin?origin=admin 500 (Internal Server Error) Error: Request failed with status code 500 at tu (index.8d42fd3d.js:67:8560) at nu (index.8d42fd3d.js:67:8743) at XMLHttpRequest.m (index.8d42fd3d.js:68:16 {"statusCode":500,"message":"Internal server error"} The docker container shows the following: [Nest] 19 - 08/16/2023, 9:31:18 AM ERROR [ExceptionsHandler] email/failed hoppscotch-backend | Error: email/failed hoppscotch-backend | at throwErr (/usr/src/app/dist/utils.js:13:11) hoppscotch-backend | at MailerService.sendEmail (/usr/src/app/dist/mailer/mailer.service.js:39:41) hoppscotch-backend | at async AuthService.signInMagicLink (/usr/src/app/dist/auth/auth.service.js:153:9) hoppscotch-backend | at async AuthController.signInMagicLink (/usr/src/app/dist/auth/auth.controller.js:36:31) hoppscotch-backend | at async /usr/src/app/node_modules/.pnpm/@nestjs+core@9.2.1_@nestjs+common@9.2.1_@nestjs+platform-express@9.2.1_reflect-metadata@0.1.13_rxjs@7.6.0/node_modules/@nestjs/core/router/router-execution-context.js:46:28 hoppscotch-backend | at async /usr/src/app/node_modules/.pnpm/@nestjs+core@9.2.1_@nestjs+common@9.2.1_@nestjs+platform-express@9.2.1_reflect-metadata@0.1.13_rxjs@7.6.0/node_modules/@nestjs/core/router/router-proxy.js:9:17 I am using Alma Linux 9. Please let me know if I need to make any settings related to server or If I am missing something. ### Steps to reproduce 1. Go to hoppscotch admin app. 2. Click continue with email button 3. Input your email 4. Click send the magic link button For hoppscotch app 1. Click login 2. Continue with email 3. Input your email 4. Send magic link ### Environment Production ### Version Self-hosted
Author
Owner

@YAGrandGPBL commented on GitHub (Aug 16, 2023):

+1 me too have that trouble

<!-- gh-comment-id:1680567986 --> @YAGrandGPBL commented on GitHub (Aug 16, 2023): +1 me too have that trouble
Author
Owner

@loban-v-navek commented on GitHub (Aug 17, 2023):

try MAILER_SMTP_URL="smtp://

<!-- gh-comment-id:1681638527 --> @loban-v-navek commented on GitHub (Aug 17, 2023): try MAILER_SMTP_URL="smtp://
Author
Owner

@giripradip commented on GitHub (Aug 17, 2023):

I have tried but it is not working

<!-- gh-comment-id:1681757990 --> @giripradip commented on GitHub (Aug 17, 2023): I have tried but it is not working
Author
Owner

@balub commented on GitHub (Aug 19, 2023):

Replace the existing value insideMAILER_ADDRESS_FROM with just your email like this MAILER_ADDRESS_FROM=user@domain.com

<!-- gh-comment-id:1684816454 --> @balub commented on GitHub (Aug 19, 2023): Replace the existing value inside`MAILER_ADDRESS_FROM` with just your email like this `MAILER_ADDRESS_FROM=user@domain.com`
Author
Owner

@selfing12 commented on GitHub (Aug 23, 2023):

I am also getting an error

Замените существующее значение внутри MAILER_ADDRESS_FROMтолько своим адресом электронной почты, как этоMAILER_ADDRESS_FROM=user@domain.com
done but getting the same error

[Nest] 19  - 08/23/2023, 5:54:47 AM   ERROR [ExceptionsHandler] email/failed
Error: email/failed
    at throwErr (/usr/src/app/dist/utils.js:13:11)
    at MailerService.sendEmail (/usr/src/app/dist/mailer/mailer.service.js:39:41)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async AuthService.signInMagicLink (/usr/src/app/dist/auth/auth.service.js:153:9)
    at async AuthController.signInMagicLink (/usr/src/app/dist/auth/auth.controller.js:36:31)
    at async /usr/src/app/node_modules/.pnpm/@nestjs+core@9.2.1_@nestjs+common@9.2.1_@nestjs+platform-express@9.2.1_reflect-metadata@0.1.13_rxjs@7.6.0/node_modules/@nestjs/core/router/router-execution-context.js:46:28
    at async /usr/src/app/node_modules/.pnpm/@nestjs+core@9.2.1_@nestjs+common@9.2.1_@nestjs+platform-express@9.2.1_reflect-metadata@0.1.13_rxjs@7.6.0/node_modules/@nestjs/core/router/router-proxy.js:9:17
Query Complexity: 2
<!-- gh-comment-id:1689347376 --> @selfing12 commented on GitHub (Aug 23, 2023): I am also getting an error > Замените существующее значение внутри `MAILER_ADDRESS_FROM`только своим адресом электронной почты, как это`MAILER_ADDRESS_FROM=user@domain.com` done but getting the same error ``` [Nest] 19 - 08/23/2023, 5:54:47 AM ERROR [ExceptionsHandler] email/failed Error: email/failed at throwErr (/usr/src/app/dist/utils.js:13:11) at MailerService.sendEmail (/usr/src/app/dist/mailer/mailer.service.js:39:41) at process.processTicksAndRejections (node:internal/process/task_queues:95:5) at async AuthService.signInMagicLink (/usr/src/app/dist/auth/auth.service.js:153:9) at async AuthController.signInMagicLink (/usr/src/app/dist/auth/auth.controller.js:36:31) at async /usr/src/app/node_modules/.pnpm/@nestjs+core@9.2.1_@nestjs+common@9.2.1_@nestjs+platform-express@9.2.1_reflect-metadata@0.1.13_rxjs@7.6.0/node_modules/@nestjs/core/router/router-execution-context.js:46:28 at async /usr/src/app/node_modules/.pnpm/@nestjs+core@9.2.1_@nestjs+common@9.2.1_@nestjs+platform-express@9.2.1_reflect-metadata@0.1.13_rxjs@7.6.0/node_modules/@nestjs/core/router/router-proxy.js:9:17 Query Complexity: 2 ```
Author
Owner

@giripradip commented on GitHub (Aug 23, 2023):

@balub It didn't work. I got the same error as @selfing12

<!-- gh-comment-id:1689530188 --> @giripradip commented on GitHub (Aug 23, 2023): @balub It didn't work. I got the same error as @selfing12
Author
Owner

@balub commented on GitHub (Aug 23, 2023):

Can you share your .env file ?

<!-- gh-comment-id:1690107904 --> @balub commented on GitHub (Aug 23, 2023): Can you share your .env file ?
Author
Owner

@giripradip commented on GitHub (Aug 23, 2023):

Mailer config

MAILER_SMTP_URL="smtps://noreply@mydomain.com:password@mail.mydomain.com"
MAILER_ADDRESS_FROM=noreply@mydomain.com

<!-- gh-comment-id:1690472637 --> @giripradip commented on GitHub (Aug 23, 2023): # Mailer config MAILER_SMTP_URL="smtps://noreply@mydomain.com:password@mail.mydomain.com" MAILER_ADDRESS_FROM=noreply@mydomain.com
Author
Owner

@alne88 commented on GitHub (Aug 29, 2023):

I was having similar issue, was getting timeouts when connecting to smtp. Even though I specified port 587 in the URL it seemed to still default to port 465.
I was able to overcome this by updating NestMailerModule import
https://github.com/hoppscotch/hoppscotch/blob/main/packages/hoppscotch-backend/src/mailer/mailer.module.ts#L14
to:

transport: {
  host: 'smtp.example.com',
  port: 587,
  secure: false,
  auth: {
    user: "username",
    pass: "password",
  }
}
<!-- gh-comment-id:1696965459 --> @alne88 commented on GitHub (Aug 29, 2023): I was having similar issue, was getting timeouts when connecting to smtp. Even though I specified port 587 in the URL it seemed to still default to port 465. I was able to overcome this by updating NestMailerModule import https://github.com/hoppscotch/hoppscotch/blob/main/packages/hoppscotch-backend/src/mailer/mailer.module.ts#L14 to: ``` transport: { host: 'smtp.example.com', port: 587, secure: false, auth: { user: "username", pass: "password", } } ```
Author
Owner

@selfing12 commented on GitHub (Sep 6, 2023):

У меня была аналогичная проблема: при подключении к smtp возникали тайм-ауты. Несмотря на то, что я указал порт 587 в URL-адресе, по умолчанию он по-прежнему использует порт 465. Мне удалось преодолеть это, обновив импорт NestMailerModule https://github.com/hoppscotch/hoppscotch/blob/main/packages/hoppscotch-backend/ src/mailer/mailer.module.ts#L14 для:

transport: {
  host: 'smtp.example.com',
  port: 587,
  secure: false,
  auth: {
    user: "username",
    pass: "password",
  }
}

there are no timeouts, there is an error 500 and an error in the backend container

<!-- gh-comment-id:1707687381 --> @selfing12 commented on GitHub (Sep 6, 2023): > У меня была аналогичная проблема: при подключении к smtp возникали тайм-ауты. Несмотря на то, что я указал порт 587 в URL-адресе, по умолчанию он по-прежнему использует порт 465. Мне удалось преодолеть это, обновив импорт NestMailerModule [https://github.com/hoppscotch/hoppscotch/blob/main/packages/hoppscotch-backend/ src/mailer/mailer.module.ts#L14](https://github.com/hoppscotch/hoppscotch/blob/main/packages/hoppscotch-backend/src/mailer/mailer.module.ts#L14) для: > > ``` > transport: { > host: 'smtp.example.com', > port: 587, > secure: false, > auth: { > user: "username", > pass: "password", > } > } > ``` there are no timeouts, there is an error 500 and an error in the backend container
Author
Owner

@Mvnrxck commented on GitHub (Sep 11, 2023):

Have the same problem, do you know how to solve this? I can't find anything about this Issue.

<!-- gh-comment-id:1713722496 --> @Mvnrxck commented on GitHub (Sep 11, 2023): Have the same problem, do you know how to solve this? I can't find anything about this Issue.
Author
Owner

@giripradip commented on GitHub (Sep 12, 2023):

Not yet. It is still not working for me as well.

<!-- gh-comment-id:1715651442 --> @giripradip commented on GitHub (Sep 12, 2023): Not yet. It is still not working for me as well.
Author
Owner

@a-camacho commented on GitHub (Sep 14, 2023):

Same issue here, any information ?
Don't really want to modify by hand my NestMailerModule. But if it's really needed ...

<!-- gh-comment-id:1718871727 --> @a-camacho commented on GitHub (Sep 14, 2023): Same issue here, any information ? Don't really want to modify by hand my NestMailerModule. But if it's really needed ...
Author
Owner

@philippos86 commented on GitHub (Sep 14, 2023):

Facing similar issue here ...

<!-- gh-comment-id:1718895959 --> @philippos86 commented on GitHub (Sep 14, 2023): Facing similar issue here ...
Author
Owner

@mayzyo commented on GitHub (Sep 16, 2023):

Same issue here. Is this an issue only in the latest build? I don't mind reverting to an older build if that solves the problem. Can't even start using hoppscotch at the moment...

<!-- gh-comment-id:1722204351 --> @mayzyo commented on GitHub (Sep 16, 2023): Same issue here. Is this an issue only in the latest build? I don't mind reverting to an older build if that solves the problem. Can't even start using hoppscotch at the moment...
Author
Owner

@mayzyo commented on GitHub (Sep 16, 2023):

My solution is to overwrite /usr/src/app/packages/hoppscotch-backend/dist/mailer/mailer.module.js with the script below. It effectively replaces the section using MAIL_SMTP_URL env variable with the env variables below, allowing for more flexibility in controlling the behaviour of nestjs mailer:

SMTP_HOST=smtp.domain.com
SMTP_PORT=465
SMTP_IGNORE_TLS=false
SMTP_SECURE=true
SMTP_REJECT_UNAUTHORIZED=false
SMTP_USER=user@domain.com
SMTP_PASS=pass

For my issue, it was a self-signed certificate, which really only needed tls: { rejectUnauthorized: false } but it was much easier to play around with the configuration and find the problem.

It's pretty easy to replace a single file with docker, just add:
--volume /path/to/file/mailer.module.js:/usr/src/app/packages/hoppscotch-backend/dist/mailer/mailer.module.js

"use strict";
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var _a, _b;
Object.defineProperty(exports, "__esModule", { value: true });
exports.MailerModule = void 0;
const common_1 = require("@nestjs/common");
const mailer_1 = require("@nestjs-modules/mailer");
const handlebars_adapter_1 = require("@nestjs-modules/mailer/dist/adapters/handlebars.adapter");
const mailer_service_1 = require("./mailer.service");
const utils_1 = require("../utils");
const errors_1 = require("../errors");
let MailerModule = class MailerModule {
};
MailerModule = __decorate([
    (0, common_1.Module)({
        imports: [
            mailer_1.MailerModule.forRoot({
                transport: (_a = {
                    host: process.env.SMTP_HOST,
                    port: Number(process.env.SMTP_PORT),
                    ignoreTLS: process.env.SMTP_IGNORE_TLS === 'true',
                    secure: process.env.SMTP_SECURE === 'true',
                    tls: { rejectUnauthorized: process.env.SMTP_REJECT_UNAUTHORIZED === 'true' },
                    auth: {
                      user: process.env.SMTP_USER,
                      pass: process.env.SMTP_PASS,
                    },
                  }) !== null && _a !== void 0 ? _a : (0, utils_1.throwErr)(errors_1.MAILER_SMTP_URL_UNDEFINED),
                defaults: {
                    from: (_b = process.env.MAILER_ADDRESS_FROM) !== null && _b !== void 0 ? _b : (0, utils_1.throwErr)(errors_1.MAILER_FROM_ADDRESS_UNDEFINED),
                },
                template: {
                    dir: __dirname + '/templates',
                    adapter: new handlebars_adapter_1.HandlebarsAdapter(),
                },
            }),
        ],
        providers: [mailer_service_1.MailerService],
        exports: [mailer_service_1.MailerService],
    })                                              
], MailerModule);                                   
exports.MailerModule = MailerModule;
<!-- gh-comment-id:1722213447 --> @mayzyo commented on GitHub (Sep 16, 2023): My solution is to overwrite `/usr/src/app/packages/hoppscotch-backend/dist/mailer/mailer.module.js` with the script below. It effectively replaces the section using `MAIL_SMTP_URL` env variable with the env variables below, allowing for more flexibility in controlling the behaviour of nestjs mailer: `SMTP_HOST=smtp.domain.com` `SMTP_PORT=465` `SMTP_IGNORE_TLS=false` `SMTP_SECURE=true` `SMTP_REJECT_UNAUTHORIZED=false` `SMTP_USER=user@domain.com` `SMTP_PASS=pass` For my issue, it was a self-signed certificate, which really only needed `tls: { rejectUnauthorized: false }` but it was much easier to play around with the configuration and find the problem. It's pretty easy to replace a single file with docker, just add: `--volume /path/to/file/mailer.module.js:/usr/src/app/packages/hoppscotch-backend/dist/mailer/mailer.module.js` ``` "use strict"; var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; return c > 3 && r && Object.defineProperty(target, key, r), r; }; var _a, _b; Object.defineProperty(exports, "__esModule", { value: true }); exports.MailerModule = void 0; const common_1 = require("@nestjs/common"); const mailer_1 = require("@nestjs-modules/mailer"); const handlebars_adapter_1 = require("@nestjs-modules/mailer/dist/adapters/handlebars.adapter"); const mailer_service_1 = require("./mailer.service"); const utils_1 = require("../utils"); const errors_1 = require("../errors"); let MailerModule = class MailerModule { }; MailerModule = __decorate([ (0, common_1.Module)({ imports: [ mailer_1.MailerModule.forRoot({ transport: (_a = { host: process.env.SMTP_HOST, port: Number(process.env.SMTP_PORT), ignoreTLS: process.env.SMTP_IGNORE_TLS === 'true', secure: process.env.SMTP_SECURE === 'true', tls: { rejectUnauthorized: process.env.SMTP_REJECT_UNAUTHORIZED === 'true' }, auth: { user: process.env.SMTP_USER, pass: process.env.SMTP_PASS, }, }) !== null && _a !== void 0 ? _a : (0, utils_1.throwErr)(errors_1.MAILER_SMTP_URL_UNDEFINED), defaults: { from: (_b = process.env.MAILER_ADDRESS_FROM) !== null && _b !== void 0 ? _b : (0, utils_1.throwErr)(errors_1.MAILER_FROM_ADDRESS_UNDEFINED), }, template: { dir: __dirname + '/templates', adapter: new handlebars_adapter_1.HandlebarsAdapter(), }, }), ], providers: [mailer_service_1.MailerService], exports: [mailer_service_1.MailerService], }) ], MailerModule); exports.MailerModule = MailerModule; ```
Author
Owner

@T-helper commented on GitHub (Sep 21, 2023):

Thanks @mayzyo, your solution is working for me with gmail smtp authorization well ! It would be good to see in main branch

<!-- gh-comment-id:1729035661 --> @T-helper commented on GitHub (Sep 21, 2023): Thanks @mayzyo, your solution is working for me with gmail smtp authorization well ! It would be good to see in main branch
Author
Owner

@a-camacho commented on GitHub (Sep 21, 2023):

My solution is to overwrite /usr/src/app/packages/hoppscotch-backend/dist/mailer/mailer.module.js with the script below. It effectively replaces the section using MAIL_SMTP_URL env variable with the env variables below, allowing for more flexibility in controlling the behaviour of nestjs mailer:

SMTP_HOST=smtp.domain.com SMTP_PORT=465 SMTP_IGNORE_TLS=false SMTP_SECURE=true SMTP_REJECT_UNAUTHORIZED=false SMTP_USER=user@domain.com SMTP_PASS=pass

For my issue, it was a self-signed certificate, which really only needed tls: { rejectUnauthorized: false } but it was much easier to play around with the configuration and find the problem.

It's pretty easy to replace a single file with docker, just add: --volume /path/to/file/mailer.module.js:/usr/src/app/packages/hoppscotch-backend/dist/mailer/mailer.module.js

"use strict";
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var _a, _b;
Object.defineProperty(exports, "__esModule", { value: true });
exports.MailerModule = void 0;
const common_1 = require("@nestjs/common");
const mailer_1 = require("@nestjs-modules/mailer");
const handlebars_adapter_1 = require("@nestjs-modules/mailer/dist/adapters/handlebars.adapter");
const mailer_service_1 = require("./mailer.service");
const utils_1 = require("../utils");
const errors_1 = require("../errors");
let MailerModule = class MailerModule {
};
MailerModule = __decorate([
    (0, common_1.Module)({
        imports: [
            mailer_1.MailerModule.forRoot({
                transport: (_a = {
                    host: process.env.SMTP_HOST,
                    port: Number(process.env.SMTP_PORT),
                    ignoreTLS: process.env.SMTP_IGNORE_TLS === 'true',
                    secure: process.env.SMTP_SECURE === 'true',
                    tls: { rejectUnauthorized: process.env.SMTP_REJECT_UNAUTHORIZED === 'true' },
                    auth: {
                      user: process.env.SMTP_USER,
                      pass: process.env.SMTP_PASS,
                    },
                  }) !== null && _a !== void 0 ? _a : (0, utils_1.throwErr)(errors_1.MAILER_SMTP_URL_UNDEFINED),
                defaults: {
                    from: (_b = process.env.MAILER_ADDRESS_FROM) !== null && _b !== void 0 ? _b : (0, utils_1.throwErr)(errors_1.MAILER_FROM_ADDRESS_UNDEFINED),
                },
                template: {
                    dir: __dirname + '/templates',
                    adapter: new handlebars_adapter_1.HandlebarsAdapter(),
                },
            }),
        ],
        providers: [mailer_service_1.MailerService],
        exports: [mailer_service_1.MailerService],
    })                                              
], MailerModule);                                   
exports.MailerModule = MailerModule;

Thanks, it works for me (for solving SMTP problem).
But deploying again a new AIO stack, I got the following error :

The table public.User does not exist in the current database.

Could fix it using prisma migration command : pnpx prisma migrate deploy

Weird I didn't get it last deploys.

<!-- gh-comment-id:1729239771 --> @a-camacho commented on GitHub (Sep 21, 2023): > My solution is to overwrite `/usr/src/app/packages/hoppscotch-backend/dist/mailer/mailer.module.js` with the script below. It effectively replaces the section using `MAIL_SMTP_URL` env variable with the env variables below, allowing for more flexibility in controlling the behaviour of nestjs mailer: > > `SMTP_HOST=smtp.domain.com` `SMTP_PORT=465` `SMTP_IGNORE_TLS=false` `SMTP_SECURE=true` `SMTP_REJECT_UNAUTHORIZED=false` `SMTP_USER=user@domain.com` `SMTP_PASS=pass` > > For my issue, it was a self-signed certificate, which really only needed `tls: { rejectUnauthorized: false }` but it was much easier to play around with the configuration and find the problem. > > It's pretty easy to replace a single file with docker, just add: `--volume /path/to/file/mailer.module.js:/usr/src/app/packages/hoppscotch-backend/dist/mailer/mailer.module.js` > > ``` > "use strict"; > var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { > var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; > if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); > else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; > return c > 3 && r && Object.defineProperty(target, key, r), r; > }; > var _a, _b; > Object.defineProperty(exports, "__esModule", { value: true }); > exports.MailerModule = void 0; > const common_1 = require("@nestjs/common"); > const mailer_1 = require("@nestjs-modules/mailer"); > const handlebars_adapter_1 = require("@nestjs-modules/mailer/dist/adapters/handlebars.adapter"); > const mailer_service_1 = require("./mailer.service"); > const utils_1 = require("../utils"); > const errors_1 = require("../errors"); > let MailerModule = class MailerModule { > }; > MailerModule = __decorate([ > (0, common_1.Module)({ > imports: [ > mailer_1.MailerModule.forRoot({ > transport: (_a = { > host: process.env.SMTP_HOST, > port: Number(process.env.SMTP_PORT), > ignoreTLS: process.env.SMTP_IGNORE_TLS === 'true', > secure: process.env.SMTP_SECURE === 'true', > tls: { rejectUnauthorized: process.env.SMTP_REJECT_UNAUTHORIZED === 'true' }, > auth: { > user: process.env.SMTP_USER, > pass: process.env.SMTP_PASS, > }, > }) !== null && _a !== void 0 ? _a : (0, utils_1.throwErr)(errors_1.MAILER_SMTP_URL_UNDEFINED), > defaults: { > from: (_b = process.env.MAILER_ADDRESS_FROM) !== null && _b !== void 0 ? _b : (0, utils_1.throwErr)(errors_1.MAILER_FROM_ADDRESS_UNDEFINED), > }, > template: { > dir: __dirname + '/templates', > adapter: new handlebars_adapter_1.HandlebarsAdapter(), > }, > }), > ], > providers: [mailer_service_1.MailerService], > exports: [mailer_service_1.MailerService], > }) > ], MailerModule); > exports.MailerModule = MailerModule; > ``` Thanks, it works for me (for solving SMTP problem). But deploying again a new AIO stack, I got the following error : `The table `public.User` does not exist in the current database.` Could fix it using prisma migration command : `pnpx prisma migrate deploy` Weird I didn't get it last deploys.
Author
Owner

@martindemker commented on GitHub (Sep 26, 2023):

Thanks @mayzyo, it worked perfectly. Hopefully this gets ported into the main branch.

<!-- gh-comment-id:1735497249 --> @martindemker commented on GitHub (Sep 26, 2023): Thanks @mayzyo, it worked perfectly. Hopefully this gets ported into the main branch.
Author
Owner

@gilPts commented on GitHub (Oct 9, 2023):

Got the same issue, since i am using docker AIO i'm blocked.
Regards,

<!-- gh-comment-id:1753059695 --> @gilPts commented on GitHub (Oct 9, 2023): Got the same issue, since i am using docker AIO i'm blocked. Regards,
Author
Owner

@alastair-drong-wd commented on GitHub (Oct 13, 2023):

Also facing this issue. I kinda' wish there was a generic OAuth option I could pick so I could point my instance at my existing Dex identity provider.

<!-- gh-comment-id:1762300946 --> @alastair-drong-wd commented on GitHub (Oct 13, 2023): Also facing this issue. I kinda' wish there was a generic OAuth option I could pick so I could point my instance at my existing Dex identity provider.
Author
Owner

@bcoquell commented on GitHub (Oct 17, 2023):

Hello, using the AIO image, I was also facing issue in my case I have a simple STMP server without authentication needs, but no access on the server so I can't see the logs on server side and the generic error around email failure (Error: email/failed) was not too detailed to understand. So I follow the steps :

  • add logs in sendMail method in mailer.service.js to see real errors
  async sendEmail(to, mailDesc) 
    {
        try {
            console.log("--> sendEmail")
            await this.nestMailerService.sendMail({
                to,
                template: mailDesc.template,
                subject: this.resolveSubjectForMailDesc(mailDesc),
                context: mailDesc.variables,
            });
        }
        catch (error) {
            console.log("Error during sendEmail")
            console.log(error.toString());
            return (0, utils_1.throwErr)(errors_1.EMAIL_FAILED);
        }
    }
  • replace mailer.service.js in the image build phase with the same method of replacing mailer.module.js
  • identify a protocol error thanks to the log details, for example with user and password empty :
Backend Server | Error: Missing credentials for "PLAIN"
Backend Server | at SMTPConnection._formatError 

In the end, when I managed to add logs, I was able to see that the SMTP server was indeed contacted but it systematically received credentials which interrupted the SMTP exchange (simple SMTP with no authentication in my case).

I fix this issue by commenting the lines in the mailer.module.js (sure it has to be done with a best way sine it will break the authentication when needed) :

                    //auth: {
                    //    user: process.env.SMTP_USER,
                    //    pass: process.env.SMTP_PASS,
                    //},

and it works now :)

Finally I replace the mailer.module.js with this version (based on @mayzyo one), which put auth json block only when the SMTP_SECURE env variable is set to true :

"use strict";
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var _a, _b;
Object.defineProperty(exports, "__esModule", { value: true });
exports.MailerModule = void 0;
const common_1 = require("@nestjs/common");
const mailer_1 = require("@nestjs-modules/mailer");
const handlebars_adapter_1 = require("@nestjs-modules/mailer/dist/adapters/handlebars.adapter");
const mailer_service_1 = require("./mailer.service");
const utils_1 = require("../utils");
const errors_1 = require("../errors");
let MailerModule = class MailerModule {
};
MailerModule = __decorate([
    (0, common_1.Module)({
        imports: [
            mailer_1.MailerModule.forRoot({
                transport: (_a = process.env.SMTP_SECURE === 'true' ? {
                    host: process.env.SMTP_HOST,
                    port: Number(process.env.SMTP_PORT),
                    ignoreTLS: process.env.SMTP_IGNORE_TLS === 'true',
                    secure: true,
                    tls: { rejectUnauthorized: process.env.SMTP_REJECT_UNAUTHORIZED === 'true' },
                    auth: {
                        user: process.env.SMTP_USER,
                        pass: process.env.SMTP_PASS,
                    },
                }:{
                    host: process.env.SMTP_HOST,
                    port: Number(process.env.SMTP_PORT),
                    ignoreTLS: process.env.SMTP_IGNORE_TLS === 'true',
                    secure: false,
                    tls: { rejectUnauthorized: process.env.SMTP_REJECT_UNAUTHORIZED === 'true' },
                }) !== null && _a !== void 0 ? _a : (0, utils_1.throwErr)(errors_1.MAILER_SMTP_URL_UNDEFINED),
                defaults: {
                    from: (_b = process.env.MAILER_ADDRESS_FROM) !== null && _b !== void 0 ? _b : (0, utils_1.throwErr)(errors_1.MAILER_FROM_ADDRESS_UNDEFINED),
                },
                template: {
                    dir: __dirname + '/templates',
                    adapter: new handlebars_adapter_1.HandlebarsAdapter(),
                },
            }),
        ],
        providers: [mailer_service_1.MailerService],
        exports: [mailer_service_1.MailerService],
    })
], MailerModule);
exports.MailerModule = MailerModule;

hope it helps other people

BR,

Baptiste

<!-- gh-comment-id:1766629473 --> @bcoquell commented on GitHub (Oct 17, 2023): Hello, using the AIO image, I was also facing issue in my case I have a simple STMP server without authentication needs, but no access on the server so I can't see the logs on server side and the generic error around email failure (Error: email/failed) was not too detailed to understand. So I follow the steps : - add logs in sendMail method in mailer.service.js to see real errors ```javascript async sendEmail(to, mailDesc) { try { console.log("--> sendEmail") await this.nestMailerService.sendMail({ to, template: mailDesc.template, subject: this.resolveSubjectForMailDesc(mailDesc), context: mailDesc.variables, }); } catch (error) { console.log("Error during sendEmail") console.log(error.toString()); return (0, utils_1.throwErr)(errors_1.EMAIL_FAILED); } } ``` - replace mailer.service.js in the image build phase with the same method of replacing mailer.module.js - identify a protocol error thanks to the log details, for example with user and password empty : ``` Backend Server | Error: Missing credentials for "PLAIN" Backend Server | at SMTPConnection._formatError ``` In the end, when I managed to add logs, I was able to see that the SMTP server was indeed contacted but it systematically received credentials which interrupted the SMTP exchange (simple SMTP with no authentication in my case). I fix this issue by commenting the lines in the mailer.module.js (sure it has to be done with a best way sine it will break the authentication when needed) : ```javascript //auth: { // user: process.env.SMTP_USER, // pass: process.env.SMTP_PASS, //}, ``` and it works now :) Finally I replace the mailer.module.js with this version (based on @mayzyo one), which put auth json block only when the SMTP_SECURE env variable is set to true : ```javascript "use strict"; var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; return c > 3 && r && Object.defineProperty(target, key, r), r; }; var _a, _b; Object.defineProperty(exports, "__esModule", { value: true }); exports.MailerModule = void 0; const common_1 = require("@nestjs/common"); const mailer_1 = require("@nestjs-modules/mailer"); const handlebars_adapter_1 = require("@nestjs-modules/mailer/dist/adapters/handlebars.adapter"); const mailer_service_1 = require("./mailer.service"); const utils_1 = require("../utils"); const errors_1 = require("../errors"); let MailerModule = class MailerModule { }; MailerModule = __decorate([ (0, common_1.Module)({ imports: [ mailer_1.MailerModule.forRoot({ transport: (_a = process.env.SMTP_SECURE === 'true' ? { host: process.env.SMTP_HOST, port: Number(process.env.SMTP_PORT), ignoreTLS: process.env.SMTP_IGNORE_TLS === 'true', secure: true, tls: { rejectUnauthorized: process.env.SMTP_REJECT_UNAUTHORIZED === 'true' }, auth: { user: process.env.SMTP_USER, pass: process.env.SMTP_PASS, }, }:{ host: process.env.SMTP_HOST, port: Number(process.env.SMTP_PORT), ignoreTLS: process.env.SMTP_IGNORE_TLS === 'true', secure: false, tls: { rejectUnauthorized: process.env.SMTP_REJECT_UNAUTHORIZED === 'true' }, }) !== null && _a !== void 0 ? _a : (0, utils_1.throwErr)(errors_1.MAILER_SMTP_URL_UNDEFINED), defaults: { from: (_b = process.env.MAILER_ADDRESS_FROM) !== null && _b !== void 0 ? _b : (0, utils_1.throwErr)(errors_1.MAILER_FROM_ADDRESS_UNDEFINED), }, template: { dir: __dirname + '/templates', adapter: new handlebars_adapter_1.HandlebarsAdapter(), }, }), ], providers: [mailer_service_1.MailerService], exports: [mailer_service_1.MailerService], }) ], MailerModule); exports.MailerModule = MailerModule; ``` hope it helps other people BR, Baptiste
Author
Owner

@WestFarmer commented on GitHub (Oct 24, 2023):

same here

<!-- gh-comment-id:1776858166 --> @WestFarmer commented on GitHub (Oct 24, 2023): same here
Author
Owner

@nmella commented on GitHub (Oct 24, 2023):

+1

<!-- gh-comment-id:1778078439 --> @nmella commented on GitHub (Oct 24, 2023): +1
Author
Owner

@atefhaloui commented on GitHub (Oct 27, 2023):

Won't work even with the patch on my postfix instance :( got Timeout followed by a 504.
Looking at postfix logs, there is no connection established to the server even if a telnet is working perfectly.

My msmtp configuration:

host         mail.example.com
port         587
auth         on
tls          on
tls_starttls on
from         mailer@example.com
user         xxxxxxxxxxxx@example.com
password     <redacted>
<!-- gh-comment-id:1782867193 --> @atefhaloui commented on GitHub (Oct 27, 2023): Won't work even with the patch on my postfix instance :( got Timeout followed by a 504. Looking at postfix logs, there is no connection established to the server even if a telnet is working perfectly. My msmtp configuration: ``` host mail.example.com port 587 auth on tls on tls_starttls on from mailer@example.com user xxxxxxxxxxxx@example.com password <redacted> ```
Author
Owner

@jobartim44 commented on GitHub (Nov 3, 2023):

I'am facing the same problem, logs are not explicits.

When using a local mail service without authentication, it's work but with a real SMTP server with authentication it always fails. I tried with an internal Exchange server, with Mailjet, and with Gmail.

<!-- gh-comment-id:1792811037 --> @jobartim44 commented on GitHub (Nov 3, 2023): I'am facing the same problem, logs are not explicits. When using a local mail service without authentication, it's work but with a real SMTP server with authentication it always fails. I tried with an internal Exchange server, with Mailjet, and with Gmail.
Author
Owner

@jobartim44 commented on GitHub (Nov 6, 2023):

Hi @liyasthomas I can't create a pull request to integrate @mayzyo code that works for every people wo tested it. Is it possible to do it ?

Thanks

<!-- gh-comment-id:1794417233 --> @jobartim44 commented on GitHub (Nov 6, 2023): Hi @liyasthomas I can't create a pull request to integrate @mayzyo code that works for every people wo tested it. Is it possible to do it ? Thanks
Author
Owner

@v01t commented on GitHub (Nov 12, 2023):

Won't work even with the patch on my postfix instance :( got Timeout followed by a 504. Looking at postfix logs, there is no connection established to the server even if a telnet is working perfectly.

My msmtp configuration:

host         mail.example.com
port         587
auth         on
tls          on
tls_starttls on
from         mailer@example.com
user         xxxxxxxxxxxx@example.com
password     <redacted>

see here you may need to set secure: false and requireTLS: true like in my case,
also adding console.log(error.toString()); into catch of error in mailer.service.js cold give more hints (response to client from server)

<!-- gh-comment-id:1806969152 --> @v01t commented on GitHub (Nov 12, 2023): > Won't work even with the patch on my postfix instance :( got Timeout followed by a 504. Looking at postfix logs, there is no connection established to the server even if a telnet is working perfectly. > > My msmtp configuration: > > ``` > host mail.example.com > port 587 > auth on > tls on > tls_starttls on > from mailer@example.com > user xxxxxxxxxxxx@example.com > password <redacted> > ``` see [here](https://nodemailer.com/smtp/) you may need to set `secure: false` and `requireTLS: true` like in my case, also adding `console.log(error.toString());` into catch of error in mailer.service.js cold give more hints (response to client from server)
Author
Owner

@muellerst-hg commented on GitHub (Nov 14, 2023):

Pitfalls:

  • When using MAILER_SMTP_URL for transport configuration, keep in mind to escape/urlencode any value, especially usernames and passwords. Otherwise the underlying nodemailer might parse the URL incorrectly, using false or incomplete transport options, e.g. missing host or port options. It will definitely fail, if your password contains /, probably also with other reserved URL characters like : or @

  • Some mail servers reject mails or flag them as spam, when MAILER_ADDRESS_FROM does not follow the pattern NAME <ADDRESS@FQDN>

Debugging:

  • To debug your setup, append the following query string to MAILER_SMTP_URL to enable logging and to debug the SMTP conversation: ?logging=true&debug=true
<!-- gh-comment-id:1810138863 --> @muellerst-hg commented on GitHub (Nov 14, 2023): Pitfalls: - When using `MAILER_SMTP_URL` for transport configuration, keep in mind to escape/urlencode any value, especially usernames and passwords. Otherwise the underlying nodemailer might parse the URL incorrectly, using false or incomplete transport options, e.g. missing host or port options. It will definitely fail, if your password contains `/`, probably also with other reserved URL characters like `:` or `@` - Some mail servers reject mails or flag them as spam, when `MAILER_ADDRESS_FROM` does not follow the pattern `NAME <ADDRESS@FQDN>` Debugging: - To debug your setup, append the following query string to `MAILER_SMTP_URL` to enable logging and to debug the SMTP conversation: `?logging=true&debug=true`
Author
Owner

@bforbis commented on GitHub (Nov 14, 2023):

So I just found out that you can in fact configure the tls: { rejectUnauthorized: false } configuration via the connection string, it's just that the nodemailer documentation does not document this so I don't blame anyone who didn't find this.

You can look at the connection string parsing code here

TL;DR: Use the following to configure rejectUnauthorized

smtp://<MY_DOMAIN>:<MY_PORT>/?secure=false&tls.rejectUnauthorized=false
<!-- gh-comment-id:1811316600 --> @bforbis commented on GitHub (Nov 14, 2023): So I just found out that you can in fact configure the `tls: { rejectUnauthorized: false }` configuration via the connection string, it's just that the `nodemailer` documentation does not document this so I don't blame anyone who didn't find this. You can look at the connection string parsing code [here](https://github.com/nodemailer/nodemailer/blob/master/lib/shared/index.js#L328) **TL;DR: Use the following to configure rejectUnauthorized** ``` smtp://<MY_DOMAIN>:<MY_PORT>/?secure=false&tls.rejectUnauthorized=false ```
Author
Owner

@alastair-drong-wd commented on GitHub (Nov 15, 2023):

smtp://<MY_DOMAIN>:<MY_PORT>/?secure=false&tls.rejectUnauthorized=false

Unfortunately, this formatting did not work for me 😑

<!-- gh-comment-id:1812993364 --> @alastair-drong-wd commented on GitHub (Nov 15, 2023): > ``` > smtp://<MY_DOMAIN>:<MY_PORT>/?secure=false&tls.rejectUnauthorized=false > ``` Unfortunately, this formatting did not work for me :expressionless:
Author
Owner

@bforbis commented on GitHub (Nov 15, 2023):

smtp://<MY_DOMAIN>:<MY_PORT>/?secure=false&tls.rejectUnauthorized=false

Unfortunately, this formatting did not work for me 😑

Try also adding logger=true&debug=true. This will cause nodemailer to print out more info.

You can also test out nodemailer yourself in a sample / throwaway npm project if that's easier than doing this through hoppscotch docker. That's how I figured all this out myself

import { createTransport, SendMailOptions } from "nodemailer";


async function main() {
  // const transporter = createTransport({
  //   host: <MY_HOST>,
  //   port: <MY_PORT>,
  //   tls: { rejectUnauthorized: false },
  //   secure: false,
  //   logger: true,
  //   debug: true,
  // });

  const transporter = createTransport('smtp://<MY_DOMAIN>:<MY_PORT>/?secure=false&tls.rejectUnauthorized=false&logger=true&debug=true');

  const mailOptions: SendMailOptions = {
    from: '<from email>',
    to: '<to email>',
    subject: 'Test Email From Nodemailer',
    text: `
      TEST TEST TEST!
    `,
  };
  const info = await transporter.sendMail(mailOptions);
  console.log(info);
}

main();
<!-- gh-comment-id:1813113246 --> @bforbis commented on GitHub (Nov 15, 2023): > > ``` > > smtp://<MY_DOMAIN>:<MY_PORT>/?secure=false&tls.rejectUnauthorized=false > > ``` > > Unfortunately, this formatting did not work for me 😑 Try also adding `logger=true&debug=true`. This will cause nodemailer to print out more info. You can also test out `nodemailer` yourself in a sample / throwaway npm project if that's easier than doing this through hoppscotch docker. That's how I figured all this out myself ```ts import { createTransport, SendMailOptions } from "nodemailer"; async function main() { // const transporter = createTransport({ // host: <MY_HOST>, // port: <MY_PORT>, // tls: { rejectUnauthorized: false }, // secure: false, // logger: true, // debug: true, // }); const transporter = createTransport('smtp://<MY_DOMAIN>:<MY_PORT>/?secure=false&tls.rejectUnauthorized=false&logger=true&debug=true'); const mailOptions: SendMailOptions = { from: '<from email>', to: '<to email>', subject: 'Test Email From Nodemailer', text: ` TEST TEST TEST! `, }; const info = await transporter.sendMail(mailOptions); console.log(info); } main(); ````
Author
Owner

@muellerst-hg commented on GitHub (Nov 15, 2023):

Try also adding logging=true&debugging=true. This will cause nodemailer to print out more info.

Correct params are logging=true&debug=true

Regarding nodemailer testing: Instead of sending mails with sendMail() for testing, you could just verify the connection (incl. auth) with:

const info = await transporter.verify(function (error, success) {
  if (error) {
    console.log(error);
  } else {
    console.log("Server is ready to take our messages");
  }
});
<!-- gh-comment-id:1813173338 --> @muellerst-hg commented on GitHub (Nov 15, 2023): > Try also adding `logging=true&debugging=true`. This will cause nodemailer to print out more info. Correct params are `logging=true&debug=true` Regarding nodemailer testing: Instead of sending mails with `sendMail()` for testing, you could just verify the connection (incl. auth) with: ``` const info = await transporter.verify(function (error, success) { if (error) { console.log(error); } else { console.log("Server is ready to take our messages"); } }); ```
Author
Owner

@WestFarmer commented on GitHub (Nov 21, 2023):

I am using valid let's encrypt certs, still got this error.

Can someone explain why ?

my env:

   MAILER_SMTP_URL: "smtps://hoppscotch@itps.xxx.com:******@smtp.itps.xxx.com:587"
   MAILER_ADDRESS_FROM: "hoppscotch<from@itps.xxx.com>"
<!-- gh-comment-id:1820591853 --> @WestFarmer commented on GitHub (Nov 21, 2023): I am using valid let's encrypt certs, still got this error. Can someone explain why ? my env: ``` MAILER_SMTP_URL: "smtps://hoppscotch@itps.xxx.com:******@smtp.itps.xxx.com:587" MAILER_ADDRESS_FROM: "hoppscotch<from@itps.xxx.com>" ```
Author
Owner

@v01t commented on GitHub (Nov 21, 2023):

Hello,
I will extend my previous comment to give some more details

After digging into code and all comments above (thanks for those), I end up with following changes that works in my SMTP configuration case (STARTTLS):

/usr/src/app/packages/hoppscotch-backend/dist/mailer/mailer.module.js:

...
MailerModule = __decorate([
    (0, common_1.Module)({
        imports: [
            mailer_1.MailerModule.forRoot({
                transport: (_a = {
                    host: process.env.SMTP_HOST,
                    port: Number(process.env.SMTP_PORT),
                    ignoreTLS: process.env.SMTP_IGNORE_TLS === 'true',
                    secure: process.env.SMTP_SECURE === 'true',
                    requireTLS: process.env.SMTP_SECURE_TLS === 'true',
                    tls: { rejectUnauthorized: process.env.SMTP_REJECT_UNAUTHORIZED === 'true' },
                    auth: {
                      user: process.env.SMTP_USER,
                      pass: process.env.SMTP_PASS,
                    },
                  }) !== null && _a !== void 0 ? _a : (0, utils_1.throwErr)(errors_1.MAILER_SMTP_URL_UNDEFINED),
                defaults: {
                    from: (_b = process.env.MAILER_ADDRESS_FROM) !== null && _b !== void 0 ? _b : (0, utils_1.throwErr)(errors_1.MAILER_FROM_ADDRESS_UNDEFINED),
                },
                template: {
                    dir: __dirname + '/templates',
                    adapter: new handlebars_adapter_1.HandlebarsAdapter(),
                },
            }),
        ],
        providers: [mailer_service_1.MailerService],
        exports: [mailer_service_1.MailerService],
    })
], MailerModule);
exports.MailerModule = MailerModule;

/usr/src/app/packages/hoppscotch-backend/dist/mailer/mailer.service.js:

...
    async sendEmail(to, mailDesc) {
        try {
            await this.nestMailerService.sendMail({
                to,
                template: mailDesc.template,
                subject: this.resolveSubjectForMailDesc(mailDesc),
                context: mailDesc.variables,
            });
        }
        catch (error) {
            console.log(error.toString());
            return (0, utils_1.throwErr)(errors_1.EMAIL_FAILED);
        }
    }
...

I add console.log(error.toString()); just for debug purposes, as that's is where real error response from mail server could be seen

envs, just because they are a bit tricky for STARTTLS:

        SMTP_HOST = "domain.com"
        SMTP_PORT = 587
        SMTP_IGNORE_TLS = "false"
        SMTP_SECURE = "false"
        SMTP_SECURE_TLS = "true"
        SMTP_REJECT_UNAUTHORIZED = "false"
        SMTP_USER = "user@domain.com"
        SMTP_PASS = "password"

hope that with above info someone will save hours without digging into problem like it was for me ;)
so above could be example of required changes to support STARTTLS

Regards

<!-- gh-comment-id:1820668871 --> @v01t commented on GitHub (Nov 21, 2023): Hello, I will extend my previous [comment](https://github.com/hoppscotch/hoppscotch/issues/3257#issuecomment-1806969152) to give some more details After digging into code and all comments above (thanks for those), I end up with following changes that works in my SMTP configuration case (STARTTLS): /usr/src/app/packages/hoppscotch-backend/dist/mailer/mailer.module.js: ``` ... MailerModule = __decorate([ (0, common_1.Module)({ imports: [ mailer_1.MailerModule.forRoot({ transport: (_a = { host: process.env.SMTP_HOST, port: Number(process.env.SMTP_PORT), ignoreTLS: process.env.SMTP_IGNORE_TLS === 'true', secure: process.env.SMTP_SECURE === 'true', requireTLS: process.env.SMTP_SECURE_TLS === 'true', tls: { rejectUnauthorized: process.env.SMTP_REJECT_UNAUTHORIZED === 'true' }, auth: { user: process.env.SMTP_USER, pass: process.env.SMTP_PASS, }, }) !== null && _a !== void 0 ? _a : (0, utils_1.throwErr)(errors_1.MAILER_SMTP_URL_UNDEFINED), defaults: { from: (_b = process.env.MAILER_ADDRESS_FROM) !== null && _b !== void 0 ? _b : (0, utils_1.throwErr)(errors_1.MAILER_FROM_ADDRESS_UNDEFINED), }, template: { dir: __dirname + '/templates', adapter: new handlebars_adapter_1.HandlebarsAdapter(), }, }), ], providers: [mailer_service_1.MailerService], exports: [mailer_service_1.MailerService], }) ], MailerModule); exports.MailerModule = MailerModule; ``` /usr/src/app/packages/hoppscotch-backend/dist/mailer/mailer.service.js: ``` ... async sendEmail(to, mailDesc) { try { await this.nestMailerService.sendMail({ to, template: mailDesc.template, subject: this.resolveSubjectForMailDesc(mailDesc), context: mailDesc.variables, }); } catch (error) { console.log(error.toString()); return (0, utils_1.throwErr)(errors_1.EMAIL_FAILED); } } ... ``` I add `console.log(error.toString());` just for debug purposes, as that's is where real error response from mail server could be seen envs, just because they are a bit tricky for STARTTLS: ``` SMTP_HOST = "domain.com" SMTP_PORT = 587 SMTP_IGNORE_TLS = "false" SMTP_SECURE = "false" SMTP_SECURE_TLS = "true" SMTP_REJECT_UNAUTHORIZED = "false" SMTP_USER = "user@domain.com" SMTP_PASS = "password" ``` hope that with above info someone will save hours without digging into problem like it was for me ;) so above could be example of required changes to support STARTTLS Regards
Author
Owner

@WestFarmer commented on GitHub (Nov 22, 2023):

after append options you guys mentioned like this:
MAILER_SMTP_URL: "smtps://hoppscotch@itps.xxx.com:******@smtp.itps.xxx.com:587?logger=true&debug=true&secure=false&requireTLS=true"
I am seeing this:

Backend Server | [2023-11-22 01:03:03] DEBUG Sending mail using SMTP/6.9.1[client:6.9.1]
Backend Server | [2023-11-22 01:03:03] DEBUG Using 1 plugins for compile
Backend Server | [2023-11-22 01:03:03] DEBUG [D1mwfWcw8IU] Resolved smtp.itps.xxx.com as 172.28.6.17 [cache miss]
Backend Server | [2023-11-22 01:03:03] ERROR [D1mwfWcw8IU] 78DBDD4DF37F0000:error:0A00010B:SSL routines:ssl3_get_record:wrong version number:../deps/openssl/openssl/ssl/record/ssl3_record.c:354:
Backend Server | [2023-11-22 01:03:03] ERROR [D1mwfWcw8IU]
Backend Server | [2023-11-22 01:03:03] DEBUG [D1mwfWcw8IU] Closing connection to the server using "destroy"
Backend Server | [2023-11-22 01:03:03] ERROR Send Error: 78DBDD4DF37F0000:error:0A00010B:SSL routines:ssl3_get_record:wrong version number:../deps/openssl/openssl/ssl/record/ssl3_record.c:354:
Backend Server | [2023-11-22 01:03:03] ERROR
Backend Server | [Nest] 61  - 11/22/2023, 1:03:03 AM   ERROR [ExceptionsHandler] email/failed
<!-- gh-comment-id:1821938870 --> @WestFarmer commented on GitHub (Nov 22, 2023): after append options you guys mentioned like this: `MAILER_SMTP_URL: "smtps://hoppscotch@itps.xxx.com:******@smtp.itps.xxx.com:587?logger=true&debug=true&secure=false&requireTLS=true"` I am seeing this: ``` Backend Server | [2023-11-22 01:03:03] DEBUG Sending mail using SMTP/6.9.1[client:6.9.1] Backend Server | [2023-11-22 01:03:03] DEBUG Using 1 plugins for compile Backend Server | [2023-11-22 01:03:03] DEBUG [D1mwfWcw8IU] Resolved smtp.itps.xxx.com as 172.28.6.17 [cache miss] Backend Server | [2023-11-22 01:03:03] ERROR [D1mwfWcw8IU] 78DBDD4DF37F0000:error:0A00010B:SSL routines:ssl3_get_record:wrong version number:../deps/openssl/openssl/ssl/record/ssl3_record.c:354: Backend Server | [2023-11-22 01:03:03] ERROR [D1mwfWcw8IU] Backend Server | [2023-11-22 01:03:03] DEBUG [D1mwfWcw8IU] Closing connection to the server using "destroy" Backend Server | [2023-11-22 01:03:03] ERROR Send Error: 78DBDD4DF37F0000:error:0A00010B:SSL routines:ssl3_get_record:wrong version number:../deps/openssl/openssl/ssl/record/ssl3_record.c:354: Backend Server | [2023-11-22 01:03:03] ERROR Backend Server | [Nest] 61 - 11/22/2023, 1:03:03 AM ERROR [ExceptionsHandler] email/failed ```
Author
Owner

@muellerst-hg commented on GitHub (Nov 22, 2023):

after append options you guys mentioned like this: MAILER_SMTP_URL: "smtps://hoppscotch@itps.xxx.com:******@smtp.itps.xxx.com:587?logger=true&debug=true&secure=false&requireTLS=true" I am seeing this:

If your smtp server relies on STARTTLS instead of TLS/SSL , use smtp://. Port 587 usually isused for this scenario.
If your smtp server requires TLS/SSL , use smtps:// Port 465 usually isused for this scenario

Here are some short explanations: https://mailtrap.io/blog/starttls-ssl-tls/

Backend Server | [2023-11-22 01:03:03] ERROR Send Error: 78DBDD4DF37F0000:error:0A00010B:SSL routines:ssl3_get_record:wrong version number:../deps/openssl/openssl/ssl/record/ssl3_record.c:354:

This error indicates that your server does not support SSL/TLS on port 587. Try using smtp://

Btw. you better rotate secrets, Github sends email notifications as soon as a comment was added.

<!-- gh-comment-id:1822239599 --> @muellerst-hg commented on GitHub (Nov 22, 2023): > after append options you guys mentioned like this: `MAILER_SMTP_URL: "smtps://hoppscotch@itps.xxx.com:******@smtp.itps.xxx.com:587?logger=true&debug=true&secure=false&requireTLS=true"` I am seeing this: If your smtp server relies on STARTTLS instead of TLS/SSL , use `smtp://`. Port 587 usually isused for this scenario. If your smtp server requires TLS/SSL , use `smtps://` Port 465 usually isused for this scenario Here are some short explanations: https://mailtrap.io/blog/starttls-ssl-tls/ > Backend Server | [2023-11-22 01:03:03] ERROR Send Error: 78DBDD4DF37F0000:error:0A00010B:SSL routines:ssl3_get_record:wrong version number:../deps/openssl/openssl/ssl/record/ssl3_record.c:354: This error indicates that your server does not support SSL/TLS on port 587. Try using `smtp://` Btw. you better rotate secrets, Github sends email notifications as soon as a comment was added.
Author
Owner

@simpleway commented on GitHub (Jan 15, 2024):

Have the same issue:

Backend Server | [Nest] 57 - 01/15/2024, 5:28:40 AM ERROR [ExceptionsHandler] email/failed
Backend Server | Error: email/failed
Backend Server | at throwErr (/usr/src/app/packages/hoppscotch-backend/dist/utils.js:14:11)
Backend Server | at MailerService.sendEmail (/usr/src/app/packages/hoppscotch-backend/dist/mailer/mailer.service.js:39:41)
Backend Server | at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
Backend Server | at async AuthService.signInMagicLink (/usr/src/app/packages/hoppscotch-backend/dist/auth/auth.service.js:159:9)
Backend Server | at async AuthController.signInMagicLink (/usr/src/app/packages/hoppscotch-backend/dist/auth/auth.controller.js:46:31)
Backend Server | at async /usr/src/app/node_modules/.pnpm/@nestjs+core@10.2.7_@nestjs+common@10.2.7_@nestjs+platform-express@10.2.7_reflect-metadata@0.1.13_rxjs@7.6.0/node_modules/@nestjs/core/router/router-execution-context.js:46:28
Backend Server | at async /usr/src/app/node_modules/.pnpm/@nestjs+core@10.2.7_@nestjs+common@10.2.7_@nestjs+platform-express@10.2.7_reflect-metadata@0.1.13_rxjs@7.6.0/node_modules/@nestjs/core/router/router-proxy.js:9:17

When I add MAILER_SMTP_URL=smtp://smtp.xxxxx.com:25?logger=true&debug=true (no authentication), I don't see any additional logs print out. I'm running AIO@2023.12.2 on kubernetes. Have I missed something?

<!-- gh-comment-id:1891331993 --> @simpleway commented on GitHub (Jan 15, 2024): Have the same issue: Backend Server | [Nest] 57 - 01/15/2024, 5:28:40 AM ERROR [ExceptionsHandler] email/failed Backend Server | Error: email/failed Backend Server | at throwErr (/usr/src/app/packages/hoppscotch-backend/dist/utils.js:14:11) Backend Server | at MailerService.sendEmail (/usr/src/app/packages/hoppscotch-backend/dist/mailer/mailer.service.js:39:41) Backend Server | at process.processTicksAndRejections (node:internal/process/task_queues:95:5) Backend Server | at async AuthService.signInMagicLink (/usr/src/app/packages/hoppscotch-backend/dist/auth/auth.service.js:159:9) Backend Server | at async AuthController.signInMagicLink (/usr/src/app/packages/hoppscotch-backend/dist/auth/auth.controller.js:46:31) Backend Server | at async /usr/src/app/node_modules/.pnpm/@nestjs+core@10.2.7_@nestjs+common@10.2.7_@nestjs+platform-express@10.2.7_reflect-metadata@0.1.13_rxjs@7.6.0/node_modules/@nestjs/core/router/router-execution-context.js:46:28 Backend Server | at async /usr/src/app/node_modules/.pnpm/@nestjs+core@10.2.7_@nestjs+common@10.2.7_@nestjs+platform-express@10.2.7_reflect-metadata@0.1.13_rxjs@7.6.0/node_modules/@nestjs/core/router/router-proxy.js:9:17 When I add `MAILER_SMTP_URL=smtp://smtp.xxxxx.com:25?logger=true&debug=true` (no authentication), I don't see any additional logs print out. I'm running AIO@2023.12.2 on kubernetes. Have I missed something?
Author
Owner

@mayzyo commented on GitHub (Jan 15, 2024):

My solution is to overwrite /usr/src/app/packages/hoppscotch-backend/dist/mailer/mailer.module.js with the script below. It effectively replaces the section using MAIL_SMTP_URL env variable with the env variables below, allowing for more flexibility in controlling the behaviour of nestjs mailer:

SMTP_HOST=smtp.domain.com SMTP_PORT=465 SMTP_IGNORE_TLS=false SMTP_SECURE=true SMTP_REJECT_UNAUTHORIZED=false SMTP_USER=user@domain.com SMTP_PASS=pass

For my issue, it was a self-signed certificate, which really only needed tls: { rejectUnauthorized: false } but it was much easier to play around with the configuration and find the problem.

It's pretty easy to replace a single file with docker, just add: --volume /path/to/file/mailer.module.js:/usr/src/app/packages/hoppscotch-backend/dist/mailer/mailer.module.js

Just an update to the file in my previously posted method. I stumbled upon my container updated to 2023.12.1 breaking the file.
Here's the version of mailer.module.js that would work with this build of Hoppscotch. Everything else stays the same as my previous post:

"use strict";
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var MailerModule_1;
Object.defineProperty(exports, "__esModule", { value: true });
exports.MailerModule = void 0;
const common_1 = require("@nestjs/common");
const mailer_1 = require("@nestjs-modules/mailer");
const handlebars_adapter_1 = require("@nestjs-modules/mailer/dist/adapters/handlebars.adapter");
const mailer_service_1 = require("./mailer.service");
const utils_1 = require("../utils");
const errors_1 = require("../errors");
const config_1 = require("@nestjs/config");
const helper_1 = require("../infra-config/helper");
let MailerModule = MailerModule_1 = class MailerModule {
    static async register() {
        const env = await (0, helper_1.loadInfraConfiguration)();
        let mailerSmtpUrl = env.INFRA.MAILER_SMTP_URL;
        let mailerAddressFrom = env.INFRA.MAILER_ADDRESS_FROM;
        if (!env.INFRA.MAILER_SMTP_URL || !env.INFRA.MAILER_ADDRESS_FROM) {
            const config = new config_1.ConfigService();
            mailerSmtpUrl = config.get('MAILER_SMTP_URL');
            mailerAddressFrom = config.get('MAILER_ADDRESS_FROM');
        }
        return {
            module: MailerModule_1,
            imports: [
                mailer_1.MailerModule.forRoot({
                    transport: {
                        host: process.env.SMTP_HOST,
                        port: Number(process.env.SMTP_PORT),
                        ignoreTLS: process.env.SMTP_IGNORE_TLS === 'true',
                        secure: process.env.SMTP_SECURE === 'true',
                        tls: { rejectUnauthorized: process.env.SMTP_REJECT_UNAUTHORIZED === 'true' },
                        auth: {
                          user: process.env.SMTP_USER,
                          pass: process.env.SMTP_PASS,
                        },
                    },
                    defaults: {
                        from: mailerAddressFrom !== null && mailerAddressFrom !== void 0 ? mailerAddressFrom : (0, utils_1.throwErr)(errors_1.MAILER_FROM_ADDRESS_UNDEFINED),
                    },
                    template: {
                        dir: __dirname + '/templates',
                        adapter: new handlebars_adapter_1.HandlebarsAdapter(),
                    },
                }),
            ],
        };
    }
};
MailerModule = MailerModule_1 = __decorate([
(0, common_1.Global)(),
(0, common_1.Module)({
    imports: [],
    providers: [mailer_service_1.MailerService],
    exports: [mailer_service_1.MailerService],
})
], MailerModule);
exports.MailerModule = MailerModule;
//# sourceMappingURL=mailer.module.js.map
<!-- gh-comment-id:1891609112 --> @mayzyo commented on GitHub (Jan 15, 2024): > My solution is to overwrite `/usr/src/app/packages/hoppscotch-backend/dist/mailer/mailer.module.js` with the script below. It effectively replaces the section using `MAIL_SMTP_URL` env variable with the env variables below, allowing for more flexibility in controlling the behaviour of nestjs mailer: > > `SMTP_HOST=smtp.domain.com` `SMTP_PORT=465` `SMTP_IGNORE_TLS=false` `SMTP_SECURE=true` `SMTP_REJECT_UNAUTHORIZED=false` `SMTP_USER=user@domain.com` `SMTP_PASS=pass` > > For my issue, it was a self-signed certificate, which really only needed `tls: { rejectUnauthorized: false }` but it was much easier to play around with the configuration and find the problem. > > It's pretty easy to replace a single file with docker, just add: `--volume /path/to/file/mailer.module.js:/usr/src/app/packages/hoppscotch-backend/dist/mailer/mailer.module.js` Just an update to the file in my previously posted method. I stumbled upon my container updated to 2023.12.1 breaking the file. Here's the version of mailer.module.js that would work with this build of Hoppscotch. Everything else stays the same as my previous post: ```javascript "use strict"; var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; return c > 3 && r && Object.defineProperty(target, key, r), r; }; var MailerModule_1; Object.defineProperty(exports, "__esModule", { value: true }); exports.MailerModule = void 0; const common_1 = require("@nestjs/common"); const mailer_1 = require("@nestjs-modules/mailer"); const handlebars_adapter_1 = require("@nestjs-modules/mailer/dist/adapters/handlebars.adapter"); const mailer_service_1 = require("./mailer.service"); const utils_1 = require("../utils"); const errors_1 = require("../errors"); const config_1 = require("@nestjs/config"); const helper_1 = require("../infra-config/helper"); let MailerModule = MailerModule_1 = class MailerModule { static async register() { const env = await (0, helper_1.loadInfraConfiguration)(); let mailerSmtpUrl = env.INFRA.MAILER_SMTP_URL; let mailerAddressFrom = env.INFRA.MAILER_ADDRESS_FROM; if (!env.INFRA.MAILER_SMTP_URL || !env.INFRA.MAILER_ADDRESS_FROM) { const config = new config_1.ConfigService(); mailerSmtpUrl = config.get('MAILER_SMTP_URL'); mailerAddressFrom = config.get('MAILER_ADDRESS_FROM'); } return { module: MailerModule_1, imports: [ mailer_1.MailerModule.forRoot({ transport: { host: process.env.SMTP_HOST, port: Number(process.env.SMTP_PORT), ignoreTLS: process.env.SMTP_IGNORE_TLS === 'true', secure: process.env.SMTP_SECURE === 'true', tls: { rejectUnauthorized: process.env.SMTP_REJECT_UNAUTHORIZED === 'true' }, auth: { user: process.env.SMTP_USER, pass: process.env.SMTP_PASS, }, }, defaults: { from: mailerAddressFrom !== null && mailerAddressFrom !== void 0 ? mailerAddressFrom : (0, utils_1.throwErr)(errors_1.MAILER_FROM_ADDRESS_UNDEFINED), }, template: { dir: __dirname + '/templates', adapter: new handlebars_adapter_1.HandlebarsAdapter(), }, }), ], }; } }; MailerModule = MailerModule_1 = __decorate([ (0, common_1.Global)(), (0, common_1.Module)({ imports: [], providers: [mailer_service_1.MailerService], exports: [mailer_service_1.MailerService], }) ], MailerModule); exports.MailerModule = MailerModule; //# sourceMappingURL=mailer.module.js.map ```
Author
Owner

@Shaddowrunner414 commented on GitHub (Jan 24, 2024):

Hi there, I'm trying to setup hoppscotch community and also ran into a problem with the first signup with the magic link email.
No matter if I try it in the Admin Dashboard or the standard frontend, I get the error "request failed with status code 500".
I'm using the AIO Container, but I also tried the individual ones with the same result.
Our hMail Server does not recieve any request from the Hoppscotch-VM so the error is with hoppscotch or more likely the way I configured it. (It does not need any credentials.)
I also tried to use this fix (https://github.com/hoppscotch/hoppscotch/issues/3257#issuecomment-1891609112) with no improvements.
@mayzyo could you maybe let me know, how your variables should be configured if no authentication / credentials are needed? (I tried leaving them emtpy, commenting them, etc.)
I added the logging bits from (https://github.com/hoppscotch/hoppscotch/issues/3257#issuecomment-1766629473) and the error is a "Connection Timeout".
Using the IP of the Mailserver does not make a difference and nslookup works in the VM and the docker container.
I also set up a simple NodeJS Mail Service which worked fine and I also could integrate it into hoppscotch.

const nodemailer = require('nodemailer');

let transporter = nodemailer.createTransport({
  host: 'mailrelay.ourcompany.org', 
  port: 25,
  secure: false,
});

let mailOptions = {
  from: '"Hoppscotch" <hoppscotch@ourcompany.org>',
  to: 'my.name@ourcompany.de',
  subject: 'Test E-Mail with Node.js',
  text: 'This is a Test-E-Mail from Node.js!'
};

transporter.sendMail(mailOptions, function(error, info){
  if (error) {
    console.log(error);
  } else {
    console.log('E-Mail sent: ' + info.response);
  }
});

Then I got the mail delivery working but no content (like the magic link) was sent with these emails.
(Of course I also tried the exact same configuration that worked for the standalone mailservice in hoppscotch)
Could you help me out with the configuration?

<!-- gh-comment-id:1907593774 --> @Shaddowrunner414 commented on GitHub (Jan 24, 2024): Hi there, I'm trying to setup hoppscotch community and also ran into a problem with the first signup with the magic link email. No matter if I try it in the Admin Dashboard or the standard frontend, I get the error "request failed with status code 500". I'm using the AIO Container, but I also tried the individual ones with the same result. Our hMail Server does not recieve any request from the Hoppscotch-VM so the error is with hoppscotch or more likely the way I configured it. (It does not need any credentials.) I also tried to use this fix (https://github.com/hoppscotch/hoppscotch/issues/3257#issuecomment-1891609112) with no improvements. @mayzyo could you maybe let me know, how your variables should be configured if no authentication / credentials are needed? (I tried leaving them emtpy, commenting them, etc.) I added the logging bits from (https://github.com/hoppscotch/hoppscotch/issues/3257#issuecomment-1766629473) and the error is a "Connection Timeout". Using the IP of the Mailserver does not make a difference and nslookup works in the VM and the docker container. I also set up a simple NodeJS Mail Service which worked fine and I also could integrate it into hoppscotch. ``` const nodemailer = require('nodemailer'); let transporter = nodemailer.createTransport({ host: 'mailrelay.ourcompany.org', port: 25, secure: false, }); let mailOptions = { from: '"Hoppscotch" <hoppscotch@ourcompany.org>', to: 'my.name@ourcompany.de', subject: 'Test E-Mail with Node.js', text: 'This is a Test-E-Mail from Node.js!' }; transporter.sendMail(mailOptions, function(error, info){ if (error) { console.log(error); } else { console.log('E-Mail sent: ' + info.response); } }); ``` Then I got the mail delivery working but no content (like the magic link) was sent with these emails. (Of course I also tried the exact same configuration that worked for the standalone mailservice in hoppscotch) Could you help me out with the configuration?
Author
Owner

@mayzyo commented on GitHub (Jan 28, 2024):

@Shaddowrunner414 Sure thing. So my own configuration is as follows:

  SMTP_HOST: my@domain.com
  SMTP_PORT: '465'
  SMTP_IGNORE_TLS: 'false'
  SMTP_SECURE: 'true'
  SMTP_USER: my_name
  SMTP_PASS: password
  SMTP_REJECT_UNAUTHORIZED: 'false'

I have a email server that enforces TLS but the SSL certificate is self generated. In my case, I mainly needed the IGNORE_TLS. If you say you have no security (check your provider docs) I would assume you need to change the port to one of the insecure ports and set SECURE to false maybe. I'd leave a '' for the password, but I haven't had any experience with what you are using so can't say for sure.

Hope that helps.

<!-- gh-comment-id:1913746994 --> @mayzyo commented on GitHub (Jan 28, 2024): @Shaddowrunner414 Sure thing. So my own configuration is as follows: ``` SMTP_HOST: my@domain.com SMTP_PORT: '465' SMTP_IGNORE_TLS: 'false' SMTP_SECURE: 'true' SMTP_USER: my_name SMTP_PASS: password SMTP_REJECT_UNAUTHORIZED: 'false' ``` I have a email server that enforces TLS but the SSL certificate is self generated. In my case, I mainly needed the IGNORE_TLS. If you say you have no security (check your provider docs) I would assume you need to change the port to one of the insecure ports and set SECURE to false maybe. I'd leave a '' for the password, but I haven't had any experience with what you are using so can't say for sure. Hope that helps.
Author
Owner

@Dimutrulkin commented on GitHub (Jan 30, 2024):

Hi.
We are trying to start using the service, but we are stuck with the same error. We specify the following mail string setting:

smtps://kont-hopp@gmail.com:************@smtp.gmail.com?logger=true&debug=true

but we get an error

Backend Server | [Nest] 48  - 01/30/2024, 8:38:58 AM   ERROR [ExceptionsHandler] email/failed
Backend Server | Error: email/failed
Backend Server |     at throwErr (/usr/src/app/packages/hoppscotch-backend/dist/utils.js:14:11)
Backend Server |     at MailerService.sendEmail (/usr/src/app/packages/hoppscotch-backend/dist/mailer/mailer.service.js:39:41)
Backend Server |     at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
Backend Server |     at async AuthService.signInMagicLink (/usr/src/app/packages/hoppscotch-backend/dist/auth/auth.service.js:159:9)
Backend Server |     at async AuthController.signInMagicLink (/usr/src/app/packages/hoppscotch-backend/dist/auth/auth.controller.js:46:31)
Backend Server |     at async /usr/src/app/node_modules/.pnpm/@nestjs+core@10.2.7_@nestjs+common@10.2.7_@nestjs+platform-express@10.2.7_reflect-metadata@0.1.13_rxjs@7.6.0/node_modules/@nestjs/core/router/router-execution-context.js:46:28
Backend Server |     at async /usr/src/app/node_modules/.pnpm/@nestjs+core@10.2.7_@nestjs+common@10.2.7_@nestjs+platform-express@10.2.7_reflect-metadata@0.1.13_rxjs@7.6.0/node_modules/@nestjs/core/router/router-proxy.js:9:17

There are no Debug logs or error text are displayed.

Is it possible to perform the initial setup of the service without MagicLink and EMail? Is it possible to create the first administrator users in the database manually?

<!-- gh-comment-id:1916341957 --> @Dimutrulkin commented on GitHub (Jan 30, 2024): Hi. We are trying to start using the service, but we are stuck with the same error. We specify the following mail string setting: ``` smtps://kont-hopp@gmail.com:************@smtp.gmail.com?logger=true&debug=true ``` but we get an error ``` Backend Server | [Nest] 48 - 01/30/2024, 8:38:58 AM ERROR [ExceptionsHandler] email/failed Backend Server | Error: email/failed Backend Server | at throwErr (/usr/src/app/packages/hoppscotch-backend/dist/utils.js:14:11) Backend Server | at MailerService.sendEmail (/usr/src/app/packages/hoppscotch-backend/dist/mailer/mailer.service.js:39:41) Backend Server | at process.processTicksAndRejections (node:internal/process/task_queues:95:5) Backend Server | at async AuthService.signInMagicLink (/usr/src/app/packages/hoppscotch-backend/dist/auth/auth.service.js:159:9) Backend Server | at async AuthController.signInMagicLink (/usr/src/app/packages/hoppscotch-backend/dist/auth/auth.controller.js:46:31) Backend Server | at async /usr/src/app/node_modules/.pnpm/@nestjs+core@10.2.7_@nestjs+common@10.2.7_@nestjs+platform-express@10.2.7_reflect-metadata@0.1.13_rxjs@7.6.0/node_modules/@nestjs/core/router/router-execution-context.js:46:28 Backend Server | at async /usr/src/app/node_modules/.pnpm/@nestjs+core@10.2.7_@nestjs+common@10.2.7_@nestjs+platform-express@10.2.7_reflect-metadata@0.1.13_rxjs@7.6.0/node_modules/@nestjs/core/router/router-proxy.js:9:17 ``` There are no Debug logs or error text are displayed. Is it possible to perform the initial setup of the service without MagicLink and EMail? Is it possible to create the first administrator users in the database manually?
Author
Owner

@LucHeart commented on GitHub (Jan 30, 2024):

I tried everything from this thread. Nothing works. Can we please just have a option to ignore SSL checks?

<!-- gh-comment-id:1918084373 --> @LucHeart commented on GitHub (Jan 30, 2024): I tried everything from this thread. Nothing works. Can we please just have a option to ignore SSL checks?
Author
Owner

@LucHeart commented on GitHub (Jan 30, 2024):

Update: After looking around in the database a bit, it seems to save the settings there aswell, and does not update them from the env vars. So i dropped the database and recreated it... After that, everything works now.
/?secure=false&tls.rejectUnauthorized=false&logger=true&debug=true as arguments after the url tho. Dont know if important to my issue at all, but it sure as hell works.

<!-- gh-comment-id:1918105766 --> @LucHeart commented on GitHub (Jan 30, 2024): Update: After looking around in the database a bit, it seems to save the settings there aswell, and does not update them from the env vars. So i dropped the database and recreated it... After that, everything works now. `/?secure=false&tls.rejectUnauthorized=false&logger=true&debug=true` as arguments after the url tho. Dont know if important to my issue at all, but it sure as hell works.
Author
Owner

@dmitrycrivoy commented on GitHub (Feb 26, 2024):

Update: After looking around in the database a bit, it seems to save the settings there aswell, and does not update them from the env vars. So i dropped the database and recreated it... After that, everything works now. /?secure=false&tls.rejectUnauthorized=false&logger=true&debug=true as arguments after the url tho. Dont know if important to my issue at all, but it sure as hell works.

Thanks a lot, worked for me

<!-- gh-comment-id:1965502820 --> @dmitrycrivoy commented on GitHub (Feb 26, 2024): > Update: After looking around in the database a bit, it seems to save the settings there aswell, and does not update them from the env vars. So i dropped the database and recreated it... After that, everything works now. `/?secure=false&tls.rejectUnauthorized=false&logger=true&debug=true` as arguments after the url tho. Dont know if important to my issue at all, but it sure as hell works. Thanks a lot, worked for me
Author
Owner

@banfushen commented on GitHub (Mar 29, 2024):

I had the same problem, i solved it ok this way

  • del all container, hoppscotch-admin, hoppscotch-backend, hoppscotch-frontend, postgres
  • docker run --name -e POSTGRES_PASSWORD= -p xxx:xxx-d postgres:12-bullseye
  • docker run -it --entrypoint sh --env-file .env hoppscotch/hoppscotch-backend && pnpx prisma migrate deploy
  • docker run -d -p xxx:3000 --env-file .env --restart unless-stopped hoppscotch/hoppscotch-frontend
  • docker run -d -p xxx:3170 --env-file .env --restart unless-stopped hoppscotch/hoppscotch-backend
  • docker run -d -p xxx:3100 --env-file .env --restart unless-stopped hoppscotch/hoppscotch-admin

.env file is the same as before

<!-- gh-comment-id:2026806973 --> @banfushen commented on GitHub (Mar 29, 2024): I had the same problem, i solved it ok this way - del all container, hoppscotch-admin, hoppscotch-backend, hoppscotch-frontend, postgres - docker run --name <name> -e POSTGRES_PASSWORD=<password> -p xxx:xxx-d postgres:12-bullseye - docker run -it --entrypoint sh --env-file .env hoppscotch/hoppscotch-backend && pnpx prisma migrate deploy - docker run -d -p xxx:3000 --env-file .env --restart unless-stopped hoppscotch/hoppscotch-frontend - docker run -d -p xxx:3170 --env-file .env --restart unless-stopped hoppscotch/hoppscotch-backend - docker run -d -p xxx:3100 --env-file .env --restart unless-stopped hoppscotch/hoppscotch-admin .env file is the same as before
Author
Owner

@devops-fleks commented on GitHub (Apr 25, 2024):

@banfushen is there any option that you can share the .env with the url composition? are you using mailcatcher?

<!-- gh-comment-id:2076074105 --> @devops-fleks commented on GitHub (Apr 25, 2024): @banfushen is there any option that you can share the .env with the url composition? are you using mailcatcher?
Author
Owner

@ztom99 commented on GitHub (Jun 12, 2024):

I also have this problem,and I start the program in my local vscode, I finally solve the problem by 2 steps :
1、modify the email setting in .env

Mailer config

MAILER_SMTP_URL=smtps://myEmailName:myAuthCode@smtp.domain.com # myEmailName doesn't need to have @domain.com, it's just the email name
2、drop the database,rebuild the database hoppscotch and migrate these tables

<!-- gh-comment-id:2162799411 --> @ztom99 commented on GitHub (Jun 12, 2024): I also have this problem,and I start the program in my local vscode, I finally solve the problem by 2 steps : 1、modify the email setting in .env # Mailer config MAILER_SMTP_URL=smtps://myEmailName:myAuthCode@smtp.domain.com # myEmailName doesn't need to have @domain.com, it's just the email name 2、drop the database,rebuild the database hoppscotch and migrate these tables
Author
Owner

@aryaag commented on GitHub (Sep 13, 2024):

I was getting a few errors related to email and SMTP.

# Error 1
Backend Server | [Error: C851A5130E7F0000:error:0A00010B:SSL routines:ssl3_get_record:wrong version number:../deps/openssl/openssl/ssl/record/ssl3_record.c:354:{
Backend Server |   library: 'SSL routines',
Backend Server |   reason: 'wrong version number',
Backend Server |   code: 'ESOCKET',
Backend Server |   command: 'CONN'
Backend Server | }
# Error 2
[Nest] 19 - 08/16/2023, 9:31:18 AM ERROR [ExceptionsHandler] email/failed
hoppscotch-backend | Error: email/failed
hoppscotch-backend | at throwErr (/usr/src/app/dist/utils.js:13:11)

Both of these were fixed by removing SSL restrictions. Sharing my .env config below:

# Mailer config
MAILER_SMTP_ENABLE=true
MAILER_USE_CUSTOM_CONFIGS=true
MAILER_ADDRESS_FROM=Hoppscotch Admin <no-reply-hoppscotch@domain.com>
# The below is used if custom mailer configs is false
MAILER_SMTP_URL=smtps://user@domain.com:pass@smtp.domain.com
# The following are used if custom mailer configs is true
MAILER_SMTP_HOST=email-smtp.ap-south-1.amazonaws.com
MAILER_SMTP_PORT=587
MAILER_SMTP_SECURE=false
MAILER_SMTP_USER=DUMMY_VALUE
MAILER_SMTP_PASSWORD=DUMMY_PASSWORD
MAILER_TLS_REJECT_UNAUTHORIZED=false

See MAILER_SMTP_SECURE & MAILER_TLS_REJECT_UNAUTHORIZED above.

<!-- gh-comment-id:2348832805 --> @aryaag commented on GitHub (Sep 13, 2024): I was getting a few errors related to email and SMTP. ``` # Error 1 Backend Server | [Error: C851A5130E7F0000:error:0A00010B:SSL routines:ssl3_get_record:wrong version number:../deps/openssl/openssl/ssl/record/ssl3_record.c:354:{ Backend Server | library: 'SSL routines', Backend Server | reason: 'wrong version number', Backend Server | code: 'ESOCKET', Backend Server | command: 'CONN' Backend Server | } ``` ``` # Error 2 [Nest] 19 - 08/16/2023, 9:31:18 AM ERROR [ExceptionsHandler] email/failed hoppscotch-backend | Error: email/failed hoppscotch-backend | at throwErr (/usr/src/app/dist/utils.js:13:11) ``` Both of these were fixed by removing SSL restrictions. Sharing my `.env` config below: ``` # Mailer config MAILER_SMTP_ENABLE=true MAILER_USE_CUSTOM_CONFIGS=true MAILER_ADDRESS_FROM=Hoppscotch Admin <no-reply-hoppscotch@domain.com> # The below is used if custom mailer configs is false MAILER_SMTP_URL=smtps://user@domain.com:pass@smtp.domain.com # The following are used if custom mailer configs is true MAILER_SMTP_HOST=email-smtp.ap-south-1.amazonaws.com MAILER_SMTP_PORT=587 MAILER_SMTP_SECURE=false MAILER_SMTP_USER=DUMMY_VALUE MAILER_SMTP_PASSWORD=DUMMY_PASSWORD MAILER_TLS_REJECT_UNAUTHORIZED=false ``` See `MAILER_SMTP_SECURE` & `MAILER_TLS_REJECT_UNAUTHORIZED` above.
Author
Owner

@mrambossek commented on GitHub (Sep 14, 2024):

getting the same error as last post, with
hoppscotch/hoppscotch-backend latest 3486100de10c 2 days ago 486MB

backend-1   | Backend Server | Error from sendEmail: [Error: C841B115567F0000:error:0A00010B:SSL routines:ssl3_get_record:wrong version number:../deps/openssl/openssl/ssl/record/ssl3_record.c:354:
backend-1   | Backend Server | ] {
backend-1   | Backend Server |   library: 'SSL routines',
backend-1   | Backend Server |   reason: 'wrong version number',
backend-1   | Backend Server |   code: 'ESOCKET',
backend-1   | Backend Server |   command: 'CONN'
backend-1   | Backend Server | }
backend-1   | Backend Server | [Nest] 19  - 09/14/2024, 10:15:04 AM   ERROR [ExceptionsHandler] email/failed
backend-1   | Backend Server | Error: email/failed
backend-1   | Backend Server |     at throwErr (/dist/backend/dist/utils.js:16:11)
backend-1   | Backend Server |     at MailerService.sendEmail (/dist/backend/dist/mailer/mailer.service.js:47:41)
backend-1   | Backend Server |     at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
backend-1   | Backend Server |     at async AuthService.signInMagicLink (/dist/backend/dist/auth/auth.service.js:159:9)
backend-1   | Backend Server |     at async AuthController.signInMagicLink (/dist/backend/dist/auth/auth.controller.js:48:31)

with these settings

MAILER_SMTP_ENABLE=true
MAILER_USE_CUSTOM_CONFIGS=true
MAILER_ADDRESS_FROM=Hoppscotch <hs@mydomain.com>
MAILER_SMTP_HOST=relay.mydomain.com
MAILER_SMTP_PORT=587
MAILER_SMTP_SECURE=false
MAILER_SMTP_USER=myuser
MAILER_SMTP_PASSWORD=mypass
MAILER_TLS_REJECT_UNAUTHORIZED=false

what is even weirder - it does not even connect at all to my host - tcpdump on the relay confirms that no connection is being made. but the settings are not, at least not completely, being ignored; if i set CUSTOM_CONFIGS to false, i get Error: auth/provider_not_configured_correctly .. so it definitely uses them.

<!-- gh-comment-id:2350909064 --> @mrambossek commented on GitHub (Sep 14, 2024): getting the same error as last post, with hoppscotch/hoppscotch-backend latest 3486100de10c 2 days ago 486MB ``` backend-1 | Backend Server | Error from sendEmail: [Error: C841B115567F0000:error:0A00010B:SSL routines:ssl3_get_record:wrong version number:../deps/openssl/openssl/ssl/record/ssl3_record.c:354: backend-1 | Backend Server | ] { backend-1 | Backend Server | library: 'SSL routines', backend-1 | Backend Server | reason: 'wrong version number', backend-1 | Backend Server | code: 'ESOCKET', backend-1 | Backend Server | command: 'CONN' backend-1 | Backend Server | } backend-1 | Backend Server | [Nest] 19 - 09/14/2024, 10:15:04 AM ERROR [ExceptionsHandler] email/failed backend-1 | Backend Server | Error: email/failed backend-1 | Backend Server | at throwErr (/dist/backend/dist/utils.js:16:11) backend-1 | Backend Server | at MailerService.sendEmail (/dist/backend/dist/mailer/mailer.service.js:47:41) backend-1 | Backend Server | at process.processTicksAndRejections (node:internal/process/task_queues:95:5) backend-1 | Backend Server | at async AuthService.signInMagicLink (/dist/backend/dist/auth/auth.service.js:159:9) backend-1 | Backend Server | at async AuthController.signInMagicLink (/dist/backend/dist/auth/auth.controller.js:48:31) ``` with these settings ``` MAILER_SMTP_ENABLE=true MAILER_USE_CUSTOM_CONFIGS=true MAILER_ADDRESS_FROM=Hoppscotch <hs@mydomain.com> MAILER_SMTP_HOST=relay.mydomain.com MAILER_SMTP_PORT=587 MAILER_SMTP_SECURE=false MAILER_SMTP_USER=myuser MAILER_SMTP_PASSWORD=mypass MAILER_TLS_REJECT_UNAUTHORIZED=false ``` what is even weirder - it does not even connect at all to my host - tcpdump on the relay confirms that no connection is being made. but the settings are not, at least not completely, being ignored; if i set CUSTOM_CONFIGS to false, i get Error: auth/provider_not_configured_correctly .. so it definitely uses them.
Author
Owner

@Lifeni commented on GitHub (Sep 23, 2024):

I also encountered the problem of wrong version number. After checking the code:

github.com/hoppscotch/hoppscotch@e9e1366cc8/packages/hoppscotch-backend/src/mailer/helper.ts (L36-L56)

I found that this was because the modified environment variable value was not used, and the program still had the old environment variable. (After the .env file is modified, just recreate hoppscotch, but the environment variables under env.INFRA are not changed)

Therefore, to solve this problem, you need to run docker volume rm <hoppscotch-db>, then run docker compose up -d and pnpx prisma migrate deploy to redeploy hoppscotch.

.env:

# Mailer config
MAILER_SMTP_ENABLE=true
MAILER_USE_CUSTOM_CONFIGS=true
MAILER_ADDRESS_FROM="Example <test@example.org>"
MAILER_SMTP_HOST=smtp.example.org
MAILER_SMTP_PORT=587
MAILER_SMTP_SECURE=false
MAILER_SMTP_USER=user
MAILER_SMTP_PASSWORD=password
MAILER_TLS_REJECT_UNAUTHORIZED=false

docker-compose.yml

services:
  hoppscotch:
    container_name: hoppscotch
    restart: unless-stopped
    image: hoppscotch/hoppscotch
    depends_on:
      hoppscotch-db:
        condition: service_healthy
    command: pnpx prisma migrate deploy # After creating the container for the first time, wait for the command to finish, comment out this line, and then restart it
    env_file:
      - .env
    ports:
        - 3400:80

  hoppscotch-db:
    container_name: hoppscotch-db
    restart: unless-stopped
    image: postgres:15
    environment:
      POSTGRES_USER: hoppscotch
      POSTGRES_PASSWORD: hoppscotch
      POSTGRES_DB: hoppscotch
    healthcheck:
      test:
        [
          "CMD-SHELL",
          "sh -c 'pg_isready -U $${POSTGRES_USER} -d $${POSTGRES_DB}'",
        ]
      interval: 5s
      timeout: 5s
      retries: 10
    volumes:
      - db:/var/lib/postgresql/data

volumes:
  db:
<!-- gh-comment-id:2367266060 --> @Lifeni commented on GitHub (Sep 23, 2024): I also encountered the problem of `wrong version number`. After checking the code: https://github.com/hoppscotch/hoppscotch/blob/e9e1366cc8a0f6d3116cb4ab5a44b964d1d36128/packages/hoppscotch-backend/src/mailer/helper.ts#L36-L56 I found that this was because the modified environment variable value was not used, and the program still had the old environment variable. (After the `.env` file is modified, just recreate hoppscotch, but the environment variables under `env.INFRA` are not changed) Therefore, to solve this problem, you need to run `docker volume rm <hoppscotch-db>`, then run `docker compose up -d` and `pnpx prisma migrate deploy` to redeploy hoppscotch. `.env`: ``` # Mailer config MAILER_SMTP_ENABLE=true MAILER_USE_CUSTOM_CONFIGS=true MAILER_ADDRESS_FROM="Example <test@example.org>" MAILER_SMTP_HOST=smtp.example.org MAILER_SMTP_PORT=587 MAILER_SMTP_SECURE=false MAILER_SMTP_USER=user MAILER_SMTP_PASSWORD=password MAILER_TLS_REJECT_UNAUTHORIZED=false ``` `docker-compose.yml` ```yaml services: hoppscotch: container_name: hoppscotch restart: unless-stopped image: hoppscotch/hoppscotch depends_on: hoppscotch-db: condition: service_healthy command: pnpx prisma migrate deploy # After creating the container for the first time, wait for the command to finish, comment out this line, and then restart it env_file: - .env ports: - 3400:80 hoppscotch-db: container_name: hoppscotch-db restart: unless-stopped image: postgres:15 environment: POSTGRES_USER: hoppscotch POSTGRES_PASSWORD: hoppscotch POSTGRES_DB: hoppscotch healthcheck: test: [ "CMD-SHELL", "sh -c 'pg_isready -U $${POSTGRES_USER} -d $${POSTGRES_DB}'", ] interval: 5s timeout: 5s retries: 10 volumes: - db:/var/lib/postgresql/data volumes: db: ```
Author
Owner

@mrambossek commented on GitHub (Sep 23, 2024):

I found that this was because the modified environment variable value was not used, and the program still had the old environment variable. (After the .env file is modified, just recreate hoppscotch, but the environment variables under env.INFRA are not changed)
Therefore, to solve this problem, you need to run docker volume rm <hoppscotch-db>, then run docker compose up -d and pnpx prisma migrate deploy to redeploy hoppscotch.

d'oh. thanks for this. i am not using the AIO image, but yeah wiping the database and THEN restarting with the correct .env fixed it for me as well...

<!-- gh-comment-id:2368810797 --> @mrambossek commented on GitHub (Sep 23, 2024): > I found that this was because the modified environment variable value was not used, and the program still had the old environment variable. (After the `.env` file is modified, just recreate hoppscotch, but the environment variables under `env.INFRA` are not changed) > Therefore, to solve this problem, you need to run `docker volume rm <hoppscotch-db>`, then run `docker compose up -d` and `pnpx prisma migrate deploy` to redeploy hoppscotch. d'oh. thanks for this. i am not using the AIO image, but yeah wiping the database and THEN restarting with the correct .env fixed it for me as well...
Author
Owner

@iDschepe commented on GitHub (Nov 27, 2024):

Important:
To apply the configuration from the .env file or Docker Compose to the database, the database must be deleted first.

Alternatively, you can manually update the changes directly in the database. After that, the Docker container needs to be restarted.

Important:
After the first admin login attempt, the user will appear in the database. You can then set the "isAdmin" column to "true" for that user to make them an admin.

<!-- gh-comment-id:2504155636 --> @iDschepe commented on GitHub (Nov 27, 2024): **Important:** To apply the configuration from the .env file or Docker Compose to the database, the database must be deleted first. _Alternatively_, you can _manually_ update the changes directly in the database. After that, the Docker container needs to be restarted. Important: After the first admin login attempt, the user will appear in the database. You can then set the "isAdmin" column to "true" for that user to make them an admin.
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#1082
No description provided.