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): state machine name validation fails when tokens are used in name #14923

Closed
jpascoe opened this issue May 31, 2021 · 3 comments
Closed
Assignees
Labels
@aws-cdk/aws-stepfunctions Related to AWS StepFunctions bug This issue is a bug. needs-triage This issue or PR still needs to be triaged.

Comments

@jpascoe
Copy link

jpascoe commented May 31, 2021

A bug was introduced in 1.93.0 that causes code to break using cdk creating step function with cf parameter value used in step function name.

#13289
6c3d407
58de0de

Reproduction Steps

project_id = core.CfnParameter(
    self, id='Project Id', description='Must be unique within your account. \
    Only lowercase characters, . and - are allowed. Max 12 character length.',
    constraint_description='Must be lowercase char, numbers, . or - with a length of 1-12 char.',
    allowed_pattern='([a-z0-9.-])+', max_length=12) 

sfn_sandbox_sm, sfn_preprod_sm, sfn_prod_sm = self.create_step_functions(
    suffix='inference', project_id=project_id)

sfn_sandbox_sm = stepfunctions.StateMachine(
    self, f'state-machine-{suffix}-sandbox', definition=start_state_sandbox,
    state_machine_name=f'ml-factory-sf-{suffix}-{project_id.value_as_string}-sandbox'
)

What did you expect to happen?

Step function is created as it was in v1.92.0

What actually happened?

Traceback (most recent call last):
File "app.py", line 61, in
env=environ)
File "/usr/local/share/pip-global/jsii/_runtime.py", line 83, in call
inst = super().call(*args, **kwargs)
File "/workspaces/ml-factory-aws/stacks/cdk_pipeline_stack.py", line 95, in init
deployment_id='test', env=preprod_env)
File "/usr/local/share/pip-global/jsii/_runtime.py", line 83, in call
inst = super().call(*args, **kwargs)
File "/workspaces/ml-factory-aws/stacks/cdk_pipeline_stage_stack.py", line 51, in init
env=account_env)
File "/usr/local/share/pip-global/jsii/_runtime.py", line 83, in call
inst = super().call(*args, **kwargs)
File "/workspaces/ml-factory-aws/stacks/s3_resource_stack.py", line 42, in init
env=account_env)
File "/usr/local/share/pip-global/jsii/_runtime.py", line 83, in call
inst = super().call(*args, **kwargs)
File "/workspaces/ml-factory-aws/stacks/ds_sc_product_stack.py", line 77, in init
suffix='inference', project_id=project_id)
File "/workspaces/ml-factory-aws/stacks/ds_sc_product_stack.py", line 1199, in create_step_functions
state_machine_name=f'ml-factory-sf-{suffix}-{project_id.value_as_string}-sandbox',
File "/usr/local/share/pip-global/jsii/_runtime.py", line 83, in call
inst = super().call(*args, **kwargs)
File "/usr/local/share/pip-global/aws_cdk/aws_stepfunctions/init.py", line 5100, in init
jsii.create(StateMachine, self, [scope, id, props])
File "/usr/local/share/pip-global/jsii/_kernel/init.py", line 282, in create
for iface in getattr(klass, "jsii_ifaces", [])
File "/usr/local/share/pip-global/jsii/_kernel/providers/process.py", line 344, in create
return self._process.send(request, CreateResponse)
File "/usr/local/share/pip-global/jsii/kernel/providers/process.py", line 326, in send
raise JSIIError(resp.error) from JavaScriptError(resp.stack)
jsii.errors.JSIIError: State Machine name must match "^[0-9a-zA-Z+!@.
-]+$". Received: ml-factory-sf-inference-${Token[TOKEN.327]}-sandbox

Environment

  • CDK CLI Version : 1.93.0 (build c506d3b)
  • Framework Version:
  • Node.js Version: v14.17.0
  • OS : Debian
  • Language (Version): Python 3.7.10

Other

https://stackoverflow.com/questions/67769103/how-do-i-use-cloudformation-parameter-in-a-stepfunction-name


This is 🐛 Bug Report

@jpascoe jpascoe added bug This issue is a bug. needs-triage This issue or PR still needs to be triaged. labels May 31, 2021
@github-actions github-actions bot added the @aws-cdk/aws-stepfunctions Related to AWS StepFunctions label May 31, 2021
@shivlaks
Copy link
Contributor

shivlaks commented Jun 2, 2021

@jpascoe I believe this issue was resolved with #13970 which was included as of v1.98.0

@shivlaks
Copy link
Contributor

shivlaks commented Jun 2, 2021

i'm resolving this issue as I believe it's already been fixed. feel free to re-open if i've missed something and there is still an outstanding issue that requires attention.

@shivlaks shivlaks closed this as completed Jun 2, 2021
@github-actions
Copy link

github-actions bot commented Jun 2, 2021

⚠️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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
@aws-cdk/aws-stepfunctions Related to AWS StepFunctions bug This issue is a bug. needs-triage This issue or PR still needs to be triaged.
Projects
None yet
Development

No branches or pull requests

2 participants