Coder Social home page Coder Social logo

Comments (6)

cdiaz avatar cdiaz commented on August 20, 2024

Hi @krivochenko, It's related with this issue and will be fixed soon, thanks for reporting

from mailer.

anyx avatar anyx commented on August 20, 2024

Looks like it wasn't fixed:

const mailerTransport = nodemailer.createTransport({
    sendmail: true,
    newline: 'unix',
    path: '/usr/sbin/sendmail',
});

@Module({
    imports: [
        MailerModule.forRoot({
            transport: mailerTransport,
            defaults: {
                from: config.get('mailer.from'),
            },
            templateDir: './templates/mailer',
        }),
...
$ node index.js
[Nest] 1828   - 2018-9-6 16:20:59   [Application] Converting circular structure to JSON
TypeError: Converting circular structure to JSON
    at JSON.stringify (<anonymous>)
    at ModuleTokenFactory.getDynamicMetadataToken (/srv/project/backend/node_modules/@nestjs/core/injector/module-token-factory.js:17:45)
    at ModuleTokenFactory.create (/srv/project/backend/node_modules/@nestjs/core/injector/module-token-factory.js:11:27)
    at ModuleCompiler.compile (/srv/project/backend/node_modules/@nestjs/core/injector/compiler.js:19:47)
    at <anonymous>
    at process._tickCallback (internal/process/next_tick.js:118:7)
    at Function.Module.runMain (module.js:692:11)
    at startup (bootstrap_node.js:194:16)
    at bootstrap_node.js:666:3
 1: node::Abort() [node]
 2: 0x8cea99 [node]
 3: v8::internal::FunctionCallbackArguments::Call(void (*)(v8::FunctionCallbackInfo<v8::Value> const&)) [node]
 4: 0xb1444c [node]
 5: v8::internal::Builtin_HandleApiCall(int, v8::internal::Object**, v8::internal::Isolate*) [node]
 6: 0x154bbd1842fd
Aborted
error Command failed with exit code 134.

nest version: 5.2.0

from mailer.

RafaelTCostella avatar RafaelTCostella commented on August 20, 2024

Looks like it wasn't fixed:

const mailerTransport = nodemailer.createTransport({
    sendmail: true,
    newline: 'unix',
    path: '/usr/sbin/sendmail',
});

@Module({
    imports: [
        MailerModule.forRoot({
            transport: mailerTransport,
            defaults: {
                from: config.get('mailer.from'),
            },
            templateDir: './templates/mailer',
        }),
...
$ node index.js
[Nest] 1828   - 2018-9-6 16:20:59   [Application] Converting circular structure to JSON
TypeError: Converting circular structure to JSON
    at JSON.stringify (<anonymous>)
    at ModuleTokenFactory.getDynamicMetadataToken (/srv/project/backend/node_modules/@nestjs/core/injector/module-token-factory.js:17:45)
    at ModuleTokenFactory.create (/srv/project/backend/node_modules/@nestjs/core/injector/module-token-factory.js:11:27)
    at ModuleCompiler.compile (/srv/project/backend/node_modules/@nestjs/core/injector/compiler.js:19:47)
    at <anonymous>
    at process._tickCallback (internal/process/next_tick.js:118:7)
    at Function.Module.runMain (module.js:692:11)
    at startup (bootstrap_node.js:194:16)
    at bootstrap_node.js:666:3
 1: node::Abort() [node]
 2: 0x8cea99 [node]
 3: v8::internal::FunctionCallbackArguments::Call(void (*)(v8::FunctionCallbackInfo<v8::Value> const&)) [node]
 4: 0xb1444c [node]
 5: v8::internal::Builtin_HandleApiCall(int, v8::internal::Object**, v8::internal::Isolate*) [node]
 6: 0x154bbd1842fd
Aborted
error Command failed with exit code 134.

nest version: 5.2.0

Hello @anyx! You're making the same mistake that I!

Instead of:

const mailerTransport = nodemailer.createTransport({
    sendmail: true,
    newline: 'unix',
    path: '/usr/sbin/sendmail',
});

@Module({
    imports: [
        MailerModule.forRoot({
            transport: mailerTransport,
            defaults: {
                from: config.get('mailer.from'),
            },
            templateDir: './templates/mailer',
        }),
...

You should do:

const mailerTransport = {
    sendmail: true,
    newline: 'unix',
    path: '/usr/sbin/sendmail',
};

@Module({
    imports: [
        MailerModule.forRoot({
            transport: mailerTransport,
            defaults: {
                from: config.get('mailer.from'),
            },
            templateDir: './templates/mailer',
        }),
...

The reason is that because in this line: https://github.com/nest-modules/mailer/blob/4de893c48fe776398828ea994ca117c5ecb03c57/lib/mailer.provider.ts, mailerProvider already calls createTransport.

@cdiaz I think that we can improve docs with examples for different plugins, if you agree I would like to submit a new PR to that!

from mailer.

cdiaz avatar cdiaz commented on August 20, 2024

Hello @RafaelTCostella , your PR will be welcome, feel free to contribute.
Thanks

from mailer.

RafaelTCostella avatar RafaelTCostella commented on August 20, 2024

#8

Done!

from mailer.

cdiaz avatar cdiaz commented on August 20, 2024

Solved in v 0.4.1

from mailer.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.