Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[stepfunctions-tasks] SageMakerCreateEndpointConfig cannot use JSONPath.stringAt for ec2.InstanceType #11605

Closed
ntroutman opened this issue Nov 20, 2020 · 1 comment · Fixed by #11749
Assignees
Labels
@aws-cdk/aws-stepfunctions-tasks bug This issue is a bug. effort/small Small work item – less than a day of effort p2

Comments

@ntroutman
Copy link

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

@ntroutman ntroutman added bug This issue is a bug. needs-triage This issue or PR still needs to be triaged. labels Nov 20, 2020
@SomayaB SomayaB changed the title [aws-stepfunction-tasks] SageMakerCreateEndpointConfig cannot use JSONPath.stringAt for ec2.InstanceType [stepfunctions-tasks] SageMakerCreateEndpointConfig cannot use JSONPath.stringAt for ec2.InstanceType Nov 23, 2020
@shivlaks shivlaks added p2 effort/small Small work item – less than a day of effort labels Nov 25, 2020
@SomayaB SomayaB removed the needs-triage This issue or PR still needs to be triaged. label Nov 25, 2020
@mergify mergify bot closed this as completed in #11749 Dec 1, 2020
mergify bot pushed a commit that referenced this issue Dec 1, 2020
…erCreateEndpointConfig as input path (#11749)

Closes #11605

----

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
@github-actions
Copy link

github-actions bot commented Dec 1, 2020

⚠️COMMENT VISIBILITY WARNING⚠️

Comments on closed issues are hard for our team to see.
If you need more assistance, please either tag a team member or open a new issue that references this one.
If you wish to keep having a conversation with other community members under this issue feel free to do so.

mergify bot pushed a commit that referenced this issue Jul 26, 2021
…erCreateTransformJob as input path (#15726)

as referred in #11605 in SageMakerCreateTransformJob has the same kind of issue.

similar solution can be found at #11749


----

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
TikiTDO pushed a commit to TikiTDO/aws-cdk that referenced this issue Aug 3, 2021
…erCreateTransformJob as input path (aws#15726)

as referred in aws#11605 in SageMakerCreateTransformJob has the same kind of issue.

similar solution can be found at aws#11749


----

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
hollanddd pushed a commit to hollanddd/aws-cdk that referenced this issue Aug 26, 2021
…erCreateTransformJob as input path (aws#15726)

as referred in aws#11605 in SageMakerCreateTransformJob has the same kind of issue.

similar solution can be found at aws#11749


----

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
@aws-cdk/aws-stepfunctions-tasks bug This issue is a bug. effort/small Small work item – less than a day of effort p2
Projects
None yet
3 participants