Skip to content

TypeError when invoking nested step function by in stack reference #468

@DaveLo

Description

@DaveLo

This is a Bug report (or question?)

Description

For bug reports:

  • What went wrong?
    Trying to invoke a child machine from parent by a ref to logical id. I set the logical id using the id property as described in the docs.
  • What did you expect should have happened?
    It should deploy
  • What was the config you used?
    I've added a boilerplate example that has the same error to make reproduction as easy as possible
serverless.yml
service: sfn-test-case

frameworkVersion: '2'

provider:
  name: aws
  runtime: nodejs12.x
  lambdaHashingVersion: 20201221
  region: us-east-1
  stage: dev
  eventBridge:
    useCloudFormation: true

  package:
    individually: true
    patterns:
      - "!*.json"
      - "!*.md"

stepFunctions:
  stateMachines:
    goodbye:
      type: STANDARD
      name: someMachineName-dev
      id: goodbyeMachine
      definition:
        StartAt: ending
        States:
          ending:
            Type: Pass
            End: true
    hello:
      type: STANDARD
      definition:
        StartAt: invokeChild
        States:
          invokeChild:
            Type: Task
            End: true
            Resource: arn:aws:states:::states:startExecution
            StateMachineArn:
              Ref: goodbyeMachine

plugins:
  - serverless-step-functions
  • What stacktrace or error message from your provider did you see?
StackTrace
TypeError: Cannot read property 'StateMachineArn.$' of undefined
      at getStepFunctionsPermissions (/Users/**/**/sfn-test-case/node_modules/serverless-step-functions/lib/deploy/stepFunctions/compileIamRole.js:268:43)
      at /Users/**/**/sfn-test-case/node_modules/serverless-step-functions/lib/deploy/stepFunctions/compileIamRole.js:441:16
      at arrayMap (/Users/**/**/sfn-test-case/node_modules/lodash/lodash.js:653:23)
      at map (/Users/**/**/sfn-test-case/node_modules/lodash/lodash.js:9622:14)
      at Function.flatMap (/Users/**/**/sfn-test-case/node_modules/lodash/lodash.js:9325:26)
      at ServerlessStepFunctions.getIamPermissions (/Users/**/**/sfn-test-case/node_modules/serverless-step-functions/lib/deploy/stepFunctions/compileIamRole.js:401:12)
      at /Users/**/**/sfn-test-case/node_modules/serverless-step-functions/lib/deploy/stepFunctions/compileIamRole.js:504:56
      at Array.forEach (<anonymous>)
      at ServerlessStepFunctions.compileIamRole (/Users/**/**/sfn-test-case/node_modules/serverless-step-functions/lib/deploy/stepFunctions/compileIamRole.js:493:32)
      at ServerlessStepFunctions.tryCatcher (/Users/**/**/sfn-test-case/node_modules/bluebird/js/release/util.js:16:23)
      at Promise._settlePromiseFromHandler (/Users/**/**/sfn-test-case/node_modules/bluebird/js/release/promise.js:547:31)
      at Promise._settlePromise (/Users/**/**/sfn-test-case/node_modules/bluebird/js/release/promise.js:604:18)
      at Promise._settlePromiseCtx (/Users/**/**/sfn-test-case/node_modules/bluebird/js/release/promise.js:641:10)
      at _drainQueueStep (/Users/**/**/sfn-test-case/node_modules/bluebird/js/release/async.js:97:12)
      at _drainQueue (/Users/**/**/sfn-test-case/node_modules/bluebird/js/release/async.js:86:9)
      at Async._drainQueues (/Users/**/**/sfn-test-case/node_modules/bluebird/js/release/async.js:102:5)
      at Immediate.Async.drainQueues [as _onImmediate] (/Users/**/**/sfn-test-case/node_modules/bluebird/js/release/async.js:15:14)
      at processImmediate (node:internal/timers:464:21)

Additional Data

  • Serverless Framework Core Version you're using:
Operating System:          darwin
     Node Version:              16.4.0
     Framework Version:         2.66.0 (local)
     Plugin Version:            5.5.1
     SDK Version:               4.3.0
     Components Version:        3.17.2
  • The Plugin Version you're using: 3.2.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    area: iamIAM roles and permissionsbug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions