Skip to content

Commit

Permalink
fix(admin-ui-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 c165632 commit 7c30f0e
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions packages/admin-ui-plugin/src/plugin.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { MiddlewareConsumer, NestModule, OnApplicationBootstrap, OnModuleDestroy } from '@nestjs/common';
import { MiddlewareConsumer, NestModule } from '@nestjs/common';
import { DEFAULT_AUTH_TOKEN_HEADER_KEY } from '@vendure/common/lib/shared-constants';
import {
AdminUiAppConfig,
Expand All @@ -11,6 +11,7 @@ import {
createProxyHandler,
Logger,
PluginCommonModule,
ProcessContext,
registerPluginStartupMessage,
VendurePlugin,
} from '@vendure/core';
Expand Down Expand Up @@ -95,7 +96,7 @@ export interface AdminUiPluginOptions {
export class AdminUiPlugin implements NestModule {
private static options: AdminUiPluginOptions;

constructor(private configService: ConfigService) {}
constructor(private configService: ConfigService, private processContext: ProcessContext) {}

/**
* @description
Expand All @@ -107,6 +108,9 @@ export class AdminUiPlugin implements NestModule {
}

async configure(consumer: MiddlewareConsumer) {
if (this.processContext.isWorker) {
return;
}
const { app, hostname, route, adminUiConfig } = AdminUiPlugin.options;
const adminUiAppPath = AdminUiPlugin.isDevModeApp(app)
? path.join(app.sourcePath, 'src')
Expand Down

0 comments on commit 7c30f0e

Please sign in to comment.