-
Notifications
You must be signed in to change notification settings - Fork 4.4k
[stepfunctions-tasks] SageMakerCreateEndpointConfig cannot use JSONPath.stringAt for ec2.InstanceType #11605
Copy link
Copy link
Closed
Labels
@aws-cdk/aws-stepfunctions-tasksbugThis issue is a bug.This issue is a bug.effort/smallSmall work item – less than a day of effortSmall work item – less than a day of effortp2
Description
CDK throws an error when passing ec2.InstanceType(JsonPath.stringAt(...)) when defining the instance type used for tasks.SageMakerCreateEndpointConfig.
Reproduction Steps
new SageMakerCreateEndpointConfig(this, 'SagemakerEndpointConfig', {
endpointConfigName: sfn.JsonPath.stringAt("$.model.name"),
productionVariants: [{
instanceType: new ec2.InstanceType(sfn.JsonPath.stringAt("$.sm_endpoint_config.instance_type")),
modelName: sfn.JsonPath.stringAt("$.model.name"),
variantName: sfn.JsonPath.stringAt("$.model.name"),
}]
});What did you expect to happen?
That I could refer to the step-functions state using JsonPath to configure the instance type used in an Endpoint Configuration.
What actually happened?
CDK threw the following error:
XXXXX/node_modules/monocdk/lib/aws-stepfunctions/lib/json-path.js:193
throw new Error(`Field references must be the entire string, cannot concatenate them (found '${x}')`);
^
Error: Field references must be the entire string, cannot concatenate them (found 'ml.${Token[sm_endpoint_config.instance_type.516]}')
at jsonPathString (XXXXX/node_modules/monocdk/lib/aws-stepfunctions/lib/json-path.js:193:15)
at Object.renderString [as handleString] (XXXXX/node_modules/monocdk/lib/aws-stepfunctions/lib/json-path.js:142:18)
at recurseObject (XXXXX/node_modules/monocdk/lib/aws-stepfunctions/lib/json-path.js:86:41)
at XXXXX/node_modules/monocdk/lib/aws-stepfunctions/lib/json-path.js:127:24
at Array.map (<anonymous>)
at recurseArray (XXXXX/node_modules/monocdk/lib/aws-stepfunctions/lib/json-path.js:120:20)
at recurseObject (XXXXX/node_modules/monocdk/lib/aws-stepfunctions/lib/json-path.js:92:32)
at Object.renderObject (XXXXX/node_modules/monocdk/lib/aws-stepfunctions/lib/json-path.js:31:12)
at Function.renderObject (XXXXX/node_modules/monocdk/lib/aws-stepfunctions/lib/fields.js:212:28)
at SageMakerCreateEndpointConfig._renderTask (XXXXX/node_modules/monocdk/lib/aws-stepfunctions-tasks/lib/sagemaker/create-endpoint-config.js:32:40)
Environment
- CDK CLI Version : 1.72.0
- Framework Version: @amzn/cdk-build/2.0.0
- Node.js Version: node-v12.19.0
- OS : linux-x64 (AL2012)
- Language (Version): TypeScript
Other
It's pretty clear from the error that the SageMaker Tasks is using TypeScript string interpolation to prefix the instance type with "ml."
This is 🐛 Bug Report
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
@aws-cdk/aws-stepfunctions-tasksbugThis issue is a bug.This issue is a bug.effort/smallSmall work item – less than a day of effortSmall work item – less than a day of effortp2