serverless-step-functions icon indicating copy to clipboard operation
serverless-step-functions copied to clipboard

Error creating IAM Role for Step Functions

Open knakayama opened this issue 9 years ago • 2 comments

It looks like there are some bugs when creating IAM Role for Step Functions. This plugin try to create IAM Role when it can't find statesExecutionRole-us-east-1 role, but always fail because of some reasons.

  1. this.iamRoleName is not defined.

When createRole is invoked, this.iamRoleName variable is not set, so failing with this error message.

$ sls deploy stepf -t hellostepfunc -v
Serverless: Start to deploy hellostepfunc step function...

  Serverless Error ---------------------------------------

     Missing required key 'RoleName' in params

  Get Support --------------------------------------------
     Docs:          docs.serverless.com
     Bugs:          github.com/serverless/serverless/issues

  Your Environment Information -----------------------------
     OS:                 darwin
     Node Version:       7.1.0
     Serverless Version: 1.4.0
  1. Invalid Policy Document

Also assumeRolePolicyDocument, passed to createRole as a param, is not valid policy document. It's value must be assume role policy, not policy for invoking Lambda function. Here is a error message with passing string to this.iamRoleName.

$ sls deploy stepf -t hellostepfunc -v
Serverless: Start to deploy hellostepfunc step function...

  Serverless Error ---------------------------------------

     Has prohibited field Resource

  Get Support --------------------------------------------
     Docs:          docs.serverless.com
     Bugs:          github.com/serverless/serverless/issues

  Your Environment Information -----------------------------
     OS:                 darwin
     Node Version:       7.1.0
     Serverless Version: 1.4.0

I think it's JSON object should be looks like this.

{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Effect": "Allow",
      "Principal": {
        "Service": "states.<region-defined-in-provider>.amazonaws.com"
      },
      "Action": "sts:AssumeRole"
    }
  ]
}

And I don't know how to implement, but you have to define poliicy for invoking Lambda function somewhere in code.

Thanks for very useful plugin!

knakayama avatar Dec 30 '16 12:12 knakayama

Thank you for reporting @knakayama ! Just fixed and released v0.1.2

ご報告ありがとうございました!

horike37 avatar Dec 30 '16 13:12 horike37

thanks!

knakayama avatar Dec 30 '16 15:12 knakayama