diff --git a/packages/twenty-server/src/engine/metadata-modules/serverless-function/serverless-function.exception.ts b/packages/twenty-server/src/engine/metadata-modules/serverless-function/serverless-function.exception.ts index f5280c89d..9d28f044f 100644 --- a/packages/twenty-server/src/engine/metadata-modules/serverless-function/serverless-function.exception.ts +++ b/packages/twenty-server/src/engine/metadata-modules/serverless-function/serverless-function.exception.ts @@ -14,5 +14,6 @@ export enum ServerlessFunctionExceptionCode { SERVERLESS_FUNCTION_ALREADY_EXIST = 'SERVERLESS_FUNCTION_ALREADY_EXIST', SERVERLESS_FUNCTION_NOT_READY = 'SERVERLESS_FUNCTION_NOT_READY', SERVERLESS_FUNCTION_BUILDING = 'SERVERLESS_FUNCTION_BUILDING', + SERVERLESS_FUNCTION_CODE_UNCHANGED = 'SERVERLESS_FUNCTION_CODE_UNCHANGED', SERVERLESS_FUNCTION_EXECUTION_LIMIT_REACHED = 'SERVERLESS_FUNCTION_EXECUTION_LIMIT_REACHED', } diff --git a/packages/twenty-server/src/engine/metadata-modules/serverless-function/serverless-function.service.ts b/packages/twenty-server/src/engine/metadata-modules/serverless-function/serverless-function.service.ts index c86ab3122..58daac691 100644 --- a/packages/twenty-server/src/engine/metadata-modules/serverless-function/serverless-function.service.ts +++ b/packages/twenty-server/src/engine/metadata-modules/serverless-function/serverless-function.service.ts @@ -193,8 +193,9 @@ export class ServerlessFunctionService { ); if (deepEqual(latestCode, draftCode)) { - throw new Error( + throw new ServerlessFunctionException( 'Cannot publish a new version when code has not changed', + ServerlessFunctionExceptionCode.SERVERLESS_FUNCTION_CODE_UNCHANGED, ); } } diff --git a/packages/twenty-server/src/modules/workflow/workflow-status/jobs/workflow-statuses-update.job.ts b/packages/twenty-server/src/modules/workflow/workflow-status/jobs/workflow-statuses-update.job.ts index 3bf3dc31b..e5897f9b5 100644 --- a/packages/twenty-server/src/modules/workflow/workflow-status/jobs/workflow-statuses-update.job.ts +++ b/packages/twenty-server/src/modules/workflow/workflow-status/jobs/workflow-statuses-update.job.ts @@ -20,6 +20,7 @@ import { import { getStatusCombinationFromArray } from 'src/modules/workflow/workflow-status/utils/get-status-combination-from-array.util'; import { getStatusCombinationFromUpdate } from 'src/modules/workflow/workflow-status/utils/get-status-combination-from-update.util'; import { getWorkflowStatusesFromCombination } from 'src/modules/workflow/workflow-status/utils/get-statuses-from-combination.util'; +import { ServerlessFunctionExceptionCode } from 'src/engine/metadata-modules/serverless-function/serverless-function.exception'; export enum WorkflowVersionEventType { CREATE = 'CREATE', @@ -174,9 +175,14 @@ export class WorkflowStatusesUpdateJob { // applied between draft and lastPublished version. // If no change have been applied, we just use the same // serverless function version - this.logger.warn( - `Error while publishing serverless function '${step.settings.input.serverlessFunctionId}': ${e}`, - ); + if ( + e.code !== + ServerlessFunctionExceptionCode.SERVERLESS_FUNCTION_CODE_UNCHANGED + ) { + this.logger.error( + `Error while publishing serverless function '${step.settings.input.serverlessFunctionId}': ${e}`, + ); + } } const serverlessFunction =