diff --git a/packages/core/src/bootstrap.ts b/packages/core/src/bootstrap.ts index 460c5eecb1..35e3780a35 100644 --- a/packages/core/src/bootstrap.ts +++ b/packages/core/src/bootstrap.ts @@ -38,13 +38,29 @@ export async function bootstrap(userConfig: Partial): Promise): Promise { + if (userConfig.workerOptions && userConfig.workerOptions.runInMainProcess === true) { + Logger.useLogger(userConfig.logger || new DefaultLogger()); + const errorMessage = `Cannot bootstrap worker when "runInMainProcess" is set to true` + Logger.error(errorMessage, 'Vendure Worker'); + throw new Error(errorMessage); + } else { + return bootstrapWorkerInternal(userConfig); + } +} + +async function bootstrapWorkerInternal(userConfig: Partial): Promise { const config = await preBootstrapConfig(userConfig); if (!config.workerOptions.runInMainProcess && (config.logger as any).setDefaultContext) { (config.logger as any).setDefaultContext('Vendure Worker');