Investigate workflow user error (#10952)

Investigation related to https://github.com/twentyhq/twenty/issues/10868

- throw an error when computedVersion is undefined
This commit is contained in:
martmull
2025-03-18 14:24:21 +01:00
committed by GitHub
parent a73b440646
commit 1bd3000b5d
3 changed files with 16 additions and 9 deletions

View File

@ -288,12 +288,9 @@ export class LambdaDriver implements ServerlessDriver {
const startTime = Date.now();
const computedVersion =
version === 'latest' ? serverlessFunction.latestVersion : version;
const folderPath = getServerlessFolder({
serverlessFunction,
version: computedVersion,
version,
});
const tsCodeStream = await this.fileStorageService.read({

View File

@ -82,12 +82,9 @@ export class LocalDriver implements ServerlessDriver {
const startTime = Date.now();
const computedVersion =
version === 'latest' ? serverlessFunction.latestVersion : version;
const folderPath = getServerlessFolder({
serverlessFunction,
version: computedVersion,
version,
});
const tsCodeStream = await this.fileStorageService.read({

View File

@ -1,8 +1,14 @@
import { join } from 'path';
import { isDefined } from 'twenty-shared';
import { FileFolder } from 'src/engine/core-modules/file/interfaces/file-folder.interface';
import { ServerlessFunctionEntity } from 'src/engine/metadata-modules/serverless-function/serverless-function.entity';
import {
ServerlessFunctionException,
ServerlessFunctionExceptionCode,
} from 'src/engine/metadata-modules/serverless-function/serverless-function.exception';
export const getServerlessFolder = ({
serverlessFunction,
@ -14,10 +20,17 @@ export const getServerlessFolder = ({
const computedVersion =
version === 'latest' ? serverlessFunction.latestVersion : version;
if (!isDefined(computedVersion)) {
throw new ServerlessFunctionException(
'Cannot compute serverless folder for undefined version',
ServerlessFunctionExceptionCode.SERVERLESS_FUNCTION_VERSION_NOT_FOUND,
);
}
return join(
'workspace-' + serverlessFunction.workspaceId,
FileFolder.ServerlessFunction,
serverlessFunction.id,
computedVersion || '',
computedVersion,
);
};