Fix env not optional + serverless logging (#15186)
Several fixes after discussing with @BOHEUS - set applicationManifest env key optional - fix server local serverless function logging (introduces a new env variable `SERVERLESS_LOGS_ENABLED` defaulting to false)
This commit is contained in:
+7
-12
@@ -1,4 +1,4 @@
|
||||
import { Logger, Scope } from '@nestjs/common';
|
||||
import { Scope } from '@nestjs/common';
|
||||
|
||||
import { Process } from 'src/engine/core-modules/message-queue/decorators/process.decorator';
|
||||
import { Processor } from 'src/engine/core-modules/message-queue/decorators/processor.decorator';
|
||||
@@ -16,22 +16,17 @@ export type ServerlessFunctionTriggerJobData = {
|
||||
scope: Scope.REQUEST,
|
||||
})
|
||||
export class ServerlessFunctionTriggerJob {
|
||||
private readonly logger = new Logger(ServerlessFunctionTriggerJob.name);
|
||||
|
||||
constructor(
|
||||
private readonly serverlessFunctionService: ServerlessFunctionService,
|
||||
) {}
|
||||
|
||||
@Process(ServerlessFunctionTriggerJob.name)
|
||||
async handle(data: ServerlessFunctionTriggerJobData) {
|
||||
const result =
|
||||
await this.serverlessFunctionService.executeOneServerlessFunction(
|
||||
data.serverlessFunctionId,
|
||||
data.workspaceId,
|
||||
data.payload || {},
|
||||
'draft',
|
||||
);
|
||||
|
||||
this.logger.log(result.logs);
|
||||
await this.serverlessFunctionService.executeOneServerlessFunction(
|
||||
data.serverlessFunctionId,
|
||||
data.workspaceId,
|
||||
data.payload || {},
|
||||
'draft',
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
+5
@@ -108,6 +108,11 @@ export class ServerlessFunctionService {
|
||||
version,
|
||||
);
|
||||
|
||||
if (this.twentyConfigService.get('SERVERLESS_LOGS_ENABLED')) {
|
||||
/* eslint-disable no-console */
|
||||
console.log(resultServerlessFunction.logs);
|
||||
}
|
||||
|
||||
this.auditService
|
||||
.createContext({
|
||||
workspaceId,
|
||||
|
||||
Reference in New Issue
Block a user