Describe the bug
inputDataconfig is incorrectly marked as a required field on SageMakerCreateTrainingJobProps. Forcing this value to undefined throws a Cannot read properties of undefined error.
An empty list is not accepted by SageMaker:
"1 validation errors detected: Value '[]' at 'inputDataConfig' failed to satisfy constraint: Member must have length greater than or equal to 1 (Service: AmazonSageMaker; Status Code: 400; Error Code: ValidationException; Request ID: 20b3ebdb-d89d-4dbe-882b-377d50058e93; Proxy: null)"
Relevant SageMakerCreateTrainingJob docs: https://docs.aws.amazon.com/sagemaker/latest/APIReference/API_CreateTrainingJob.html#sagemaker-CreateTrainingJob-request-InputDataConfig
Regression Issue
Last Known Working CDK Version
No response
Expected Behavior
A valid SageMakerCreateTrainingJob step function task can be created when inputDataConfig is undefined.
Current Behavior
SageMakerCreateTrainingJob throws an error when inputDataConfig is undefined.
Argument of type '{ trainingJobName: string; algorithmSpecification: { trainingImage: aws_stepfunctions_tasks.DockerImage; trainingInputMode: aws_stepfunctions_tasks.InputMode.FILE; }; outputDataConfig: { ...; }; resourceConfig: { ...; }; stoppingCondition: { ...; }; hyperparameters: {}; }' is not assignable to parameter of type 'SageMakerCreateTrainingJobProps'.
Property 'inputDataConfig' is missing in type '{ trainingJobName: string; algorithmSpecification: { trainingImage: aws_stepfunctions_tasks.DockerImage; trainingInputMode: aws_stepfunctions_tasks.InputMode.FILE; }; outputDataConfig: { ...; }; resourceConfig: { ...; }; stoppingCondition: { ...; }; hyperparameters: {}; }' but required in type 'SageMakerCreateTrainingJobProps'.ts(2345)
Reproduction Steps
import { Duration, Size } from 'aws-cdk-lib';
import { InstanceType } from 'aws-cdk-lib/aws-ec2';
import { JsonPath } from 'aws-cdk-lib/aws-stepfunctions';
import { DockerImage, InputMode, S3Location, SageMakerCreateTrainingJob } from 'aws-cdk-lib/aws-stepfunctions-tasks';
import { Construct } from 'constructs';
class Workflow extends Construct {
constructor(scope: Construct, id: string) {
super(scope, id);
const sageMakerInvocation = new SageMakerCreateTrainingJob(this, 'Start SageMaker', {
trainingJobName: JsonPath.stringAt('$.JobName'),
algorithmSpecification: {
trainingImage: DockerImage.fromJsonExpression('$.DockerImagePath'),
trainingInputMode: InputMode.FILE,
},
// inputDataConfig: [],
outputDataConfig: {
s3OutputLocation: S3Location.fromJsonExpression('$.S3OutputPath'),
},
resourceConfig: {
instanceCount: 1,
instanceType: new InstanceType(JsonPath.stringAt('$.InstanceType')),
volumeSize: Size.gibibytes(JsonPath.numberAt('$.InstanceVolumeSize')),
},
stoppingCondition: {
maxRuntime: Duration.seconds(JsonPath.numberAt('$.MaximumJobDuration')),
},
});
}
}
Possible Solution
No response
Additional Information/Context
No response
CDK CLI Version
2.151.0 (build b8289e2)
Framework Version
No response
Node.js Version
Node.js v20.12.2
OS
macOS 14.6.1
Language
TypeScript
Language Version
5.5.4
Other information
No response
Describe the bug
inputDataconfigis incorrectly marked as a required field onSageMakerCreateTrainingJobProps. Forcing this value to undefined throws aCannot read properties of undefinederror.An empty list is not accepted by SageMaker:
Relevant SageMakerCreateTrainingJob docs: https://docs.aws.amazon.com/sagemaker/latest/APIReference/API_CreateTrainingJob.html#sagemaker-CreateTrainingJob-request-InputDataConfig
Regression Issue
Last Known Working CDK Version
No response
Expected Behavior
A valid
SageMakerCreateTrainingJobstep function task can be created wheninputDataConfigis undefined.Current Behavior
SageMakerCreateTrainingJobthrows an error wheninputDataConfigis undefined.Reproduction Steps
Possible Solution
No response
Additional Information/Context
No response
CDK CLI Version
2.151.0 (build b8289e2)
Framework Version
No response
Node.js Version
Node.js v20.12.2
OS
macOS 14.6.1
Language
TypeScript
Language Version
5.5.4
Other information
No response