serverless: Serverless fails to deploy service with a kinesis stream event: Unresolved resource dependencies [IamPolicyLambdaExecution] in the Resources block of the template

This is a Bug Report

Description

We were trying to deploy service that would read from a Kinesis stream and the deployment failed with the following message:

Template format error: Unresolved resource dependencies [IamPolicyLambdaExecution] in the Resources block of the template

I am including my serverless.yml for reference:

provider:
  name: aws
  runtime: python2.7
  region: ap-southeast-1
  role: testKinesisStream

functions:
  hello:
    handler: handler.hello
    events:
      - 
        stream:
          arn: "arn:aws:kinesis:ap-southeast-1:XXXXXXXXXXX:stream/StreamTest"
          batchSize: 100
          startingPosition: LATEST
          enabled: false

resources:
  Resources:
    testKinesisStream:
      Type: AWS::IAM::Role
      Properties:
        RoleName: test-kinesis-stream-dev-role
        AssumeRolePolicyDocument:
          Version: '2012-10-17'
          Statement:
            - Effect: "Allow"
              Principal:
                Service:
                  - "lambda.amazonaws.com"
              Action: "sts:AssumeRole"
        Policies:
          - PolicyName: test-kinesis-stream-dev-policy
            PolicyDocument:
              Version: '2012-10-17'
              Statement:
                - Effect: "Allow"
                  Action:
                    - "kinesis:DescribeStream"
                    - "kinesis:GetShardIterator"
                    - "kinesis:GetRecords"
                    - "kinesis:ListStreams"
                  Resource: "arn:aws:kinesis:ap-southeast-1:XXXXXXXXXXX:stream/StreamTest"

Additional Data

  • Serverless Framework Version you’re using: 1.4.0
  • Operating System: darwin
  • Provider Error messages: Template format error: Unresolved resource dependencies [IamPolicyLambdaExecution] in the Resources block of the template

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Comments: 15 (9 by maintainers)

Most upvoted comments

I’m also seeing this issue. Looking into it I can see DependsOn is not being filled out correctly in the compiled CF for a particular case when a custom role defined.

OK if I submit a PR for a proposed fix?

The latest version of serverless seems to have resolved my problem. Now I am able to use stream integration alongside cloudformation resource definition for lambda IAM role.

Thanks!

Hey @aashish004 thanks for reporting.

We’re currently working on fixes for the stream support in those PRs here:

Those will be merged the upcoming days (hopefully) 👍 They should resolve the problem you’re currently facing