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:
@ -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({
|
||||
|
||||
@ -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({
|
||||
|
||||
@ -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,
|
||||
);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user