Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LiquidJs adapter error on application startup #1232

Open
maelehrhard opened this issue Aug 27, 2024 · 3 comments
Open

LiquidJs adapter error on application startup #1232

maelehrhard opened this issue Aug 27, 2024 · 3 comments

Comments

@maelehrhard
Copy link

Describe the bug

Using LiquidAdapter() won't work in the MailerModule.forRoot() method.

/test-project/node_modules/@nestjs-modules/mailer/dist/adapters/liquid.adapter.js:9
        Object.assign(this.config, config);
               ^

TypeError: Cannot convert undefined or null to object
    at Function.assign (<anonymous>)
    at new LiquidAdapter (/test-project/node_modules/@nestjs-modules/mailer/dist/adapters/liquid.adapter.js:9:16)
    at Object.<anonymous> (/test-project/src/app.module.ts:12:18)
    at Module._compile (node:internal/modules/cjs/loader:1358:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1416:10)
    at Module.load (node:internal/modules/cjs/loader:1208:32)
    at Module._load (node:internal/modules/cjs/loader:1024:12)
    at Module.require (node:internal/modules/cjs/loader:1233:19)
    at require (node:internal/modules/helpers:179:18)
    at Object.<anonymous> (/test-project/src/main.ts:2:1)

To Reproduce
Steps to reproduce the behavior:

  1. Configure MailerModule:
@Module({
  imports: [
    MailerModule.forRoot({
      transport: 'smtps://[email protected]:[email protected]',
      template: {
        dir: __dirname + '/templates',
        adapter: new LiquidAdapter(),
        options: {
          strict: true,
        },
      },
    }),
  ],
  controllers: [AppController],
  providers: [AppService],
})
export class AppModule {}
  1. The app can't run, it encounters a TypeError

Additional context
This is likely related to the config not being initialized in liquid.adapter.ts

private config: Partial<Liquid['options']>;

constructor(config?: Partial<Liquid['options']>) {
Object.assign(this.config, config);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants
@maelehrhard and others