Skip to content

Wrong policy state machine generation for lambda arn #302

Open
@nikita-sheremet-clearscale

Description

This is a Bug Report

Description

Entire reproducable code you can find here

The prblem is a policy generation error for state machine when it need to invoke lambda function. The problem appeared when lambda function is passed as arn with pseudo parameters.

MyArn: arn:aws:lambda:#{AWS::Region}:#{AWS::AccountId}:function:${file(${self:custom.varFile}):custom.Name}

MyStateMachine:
  name: "my_state_machine"
  definition:
    StartAt: Start
    States:
      Start:
        Type: Task
        Resource: "${self:custom.MyArn}"
        Parameters:
          arnAsValue: "${file(${self:custom.varFile}):custom.MyArn}"
        Next: Some
      "Some":
        Type: Task
        Resource: arn:aws:states:::glue:startJobRun.sync
        Parameters:
          JobName: myJOb
        End: true

``

For bug reports:

  • What went wrong? - Policy was geenrated wrong
  • What did you expect should have happened? - state machen should be deployed
  • What stacktrace or error message from your provider did you see?
cmd.exe /c "serverless deploy"
 
 Serverless Warning --------------------------------------
 
  A valid option to satisfy the declaration 'opt:stage' could not be found.
 
Serverless: Added parameters to template
Serverless: Packaging service...
Serverless: Added parameters to template
Serverless: Uploading CloudFormation file to S3...
Serverless: Uploading artifacts...
Serverless: Validating template...
Serverless: Updating Stack...
Serverless: Checking Stack update progress...
....
Serverless: Operation failed!
Serverless: View the full error output: https://us-east-2.console.aws.amazon.com/cloudformation/...
 
  Serverless Error ---------------------------------------
 
  An error occurred: MyUnderscorestateUnderscoremachineRole - The policy failed legacy parsing (Service: AmazonIdentityManagement; Status Code: 400; Error Code: MalformedPolicyDocument; Request ID: ).
 
  Get Support --------------------------------------------
     Docs:          docs.serverless.com
     Bugs:          github.com/serverless/serverless/issues
     Issues:        forum.serverless.com
 
  Your Environment Information ---------------------------
     Operating System:          win32
     Node Version:              10.15.0
     Framework Version:         1.53.0
     Plugin Version:            3.1.1
     SDK Version:               2.1.1
     Components Core Version:   1.1.1
     Components CLI Version:    1.2.3
 

Process finished with exit code 1

Feel free to ask any questions.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions