jsii.errors.JSIIError: Cannot read properties of undefined (reading 'bindToGraph')

0

HI All

This is my first implementation of StateMachineFragment.

Goal: Attempting to create a class for re-usable lambda state. This class can take a parameter and pass this as payload to Lambda and the lambda will execute the right query based on the payload.

Below is my POC code to 'classs-ify' the lambda and the call to statemachine.

from aws_cdk import (
    Duration,
    Stack,
    # aws_sqs as sqs,
    aws_stepfunctions as _stepfunctions,
    aws_stepfunctions as sfn,
    aws_stepfunctions_tasks as _stepfunctions_tasks,
    aws_lambda as _lambda,
)
from constructs import Construct

class SubMachine(_stepfunctions.StateMachineFragment):

    def __init__(self, parent, id, *, jobTypeParam):
        super().__init__(parent, id)

        existingFunc = _lambda.Function.from_function_arn(self, "ExistingLambdaFunc", function_arn="arn:aws:lambda:us-east-1:958$#$#$#$:function:dummyFunction")

        lambda_invoked = _stepfunctions_tasks.LambdaInvoke(self, "someID", lambda_function=existingFunc)
        wait_10_seconds = _stepfunctions.Wait(self, "Wait for 10 seconds",
                                         time=_stepfunctions.WaitTime.duration(Duration.seconds(10))
                                         )

        self._start_state =  wait_10_seconds
        self._end_states = [lambda_invoked.end_states]

    def start_state(self):
        return self._start_state

    def end_states(self):
        return self._end_states

class StepfunctionsClasStack(Stack):

    def __init__(self, scope: Construct, construct_id: str, **kwargs) -> None:
        super().__init__(scope, construct_id, **kwargs)

        test_lambda_1 = SubMachine(self, "SubMachine1", jobTypeParam="one")

        state_machine = _stepfunctions.StateMachine(self, "TestStateMachine",
                                                    definition=test_lambda_1,
                                                    # role=marketo_role
                                                    )

When I try and deploy this code, I get the following error:

jsii.errors.JSIIError: Cannot read properties of undefined (reading 'bindToGraph')

I am not sure where I am going wrong.

Thoughts?

Thanks

1 Answer
0

Hi,

May I ask if this is the whole error message that is being returned? We reached out to the Step Functions team and it seems this error can be caused if the parameters that are being passed may not be correct.

If possible, can you provide the stacktrace? This is to check which line of code may be triggering the error. We can then double check the documentation to validate if there may be an issue with the parameters that are being passed.

AWS
SUPPORT ENGINEER
Ryan_A
answered 3 years ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions