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개 답변
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
지원 엔지니어
Ryan_A
답변함 2년 전

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인

관련 콘텐츠