Skip to content

Commit

Permalink
fix(email-plugin): Do not run server logic in worker context
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelbromley committed Jul 29, 2021
1 parent c3a67b6 commit f5b6ddc
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion packages/email-plugin/src/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import {
JobQueueService,
Logger,
PluginCommonModule,
ProcessContext,
registerPluginStartupMessage,
Type,
VendurePlugin,
Expand Down Expand Up @@ -177,6 +178,7 @@ export class EmailPlugin implements OnApplicationBootstrap, NestModule {
private moduleRef: ModuleRef,
private emailProcessor: EmailProcessor,
private jobQueueService: JobQueueService,
private processContext: ProcessContext,
) {}

/**
Expand Down Expand Up @@ -211,7 +213,7 @@ export class EmailPlugin implements OnApplicationBootstrap, NestModule {
configure(consumer: MiddlewareConsumer) {
const options = EmailPlugin.options;

if (isDevModeOptions(options)) {
if (isDevModeOptions(options) && this.processContext.isServer) {
Logger.info('Creating dev mailbox middleware', loggerCtx);
this.devMailbox = new DevMailbox();
consumer.apply(this.devMailbox.serve(options)).forRoutes(options.route);
Expand Down

0 comments on commit f5b6ddc

Please sign in to comment.