Handlebars templates not working on docker container

40 Views Asked by At

The "dir" path is correctly defined to dinamically change as shown in the print, but still the e-mails that i am sending is showing only a "zero" in the body. An interesting detail is that when i run locally, without docker, the e-mail rendering works.

What am i doing wrong?

@Global()
@Module({
  imports: [
    ConfigModule.forRoot({
      isGlobal: true,
    }),
    MailerModule.forRootAsync({
      useFactory: () => ({
        transport: {
          host: process.env.MAIL_HOST,
          port: +process.env.MAIL_PORT,
          secure: true,
          auth: {
            user: process.env.MAIL_USER,
            pass: process.env.MAIL_PASSWORD,
          },
          tls: {
            rejectUnauthorized: false
          }
        },
        defaults: {
          from: `no-reply <[email protected]>`,
        },
        template: {
          dir: join(__dirname, "../templates"),
          adapter: new HandlebarsAdapter(),
          options: {
            strict: true,
          },
        },
      }),
      inject: [ConfigService],
    }),
  ],
  providers: [MailService],
  exports: [MailService],
})
export class MailModule {}

Click here to see what appears in the e-mail body

I've tried changing the mail service, tried changing the path to a direct path, tried to rebuild the project, tried to put the templates html's and the dirs to an identical structure to another very similar project that has its e-mail service working correctly and nothing works.

OBS: I am running docker locally.

0

There are 0 best solutions below