Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

EventInvokeConfig does not appear in processed template when following the spec #3602

Closed
Tristano8 opened this issue May 27, 2024 · 3 comments
Labels
stage/needs-triage Automatically applied to new issues and PRs, indicating they haven't been looked at.

Comments

@Tristano8
Copy link

Description

Using an EventInvokeConfig results in a processed template that ignores these fields completely

Steps to reproduce

Deploy something like the following template:

Resources:
  ErrorReporterFunction:
    Properties:
      AutoPublishAlias: 'Live'
      CodeUri: 'bootstrap-file'
      FunctionName:
        'Fn::Sub': "${AWS::StackName}-error-reporter-function"
      Handler: 'UNUSED'
      LoggingConfig:
        ApplicationLogLevel: 'DEBUG'
        LogFormat: 'JSON'
        SystemLogLevel:
          Fn::FindInMap:
            - LambdaLogLevel
            - Ref: 'LogSeverity'
            - System
      MemorySize: 512
      Policies:
        - 'AWSLambdaBasicExecutionRole'
      Runtime: 'provided.al2'
      Timeout: 300
    Type: 'AWS::Serverless::Function'
  MyFunction:
    EventInvokeConfig:
      DestinationConfig:
        OnFailure:
          Destination': !GetAtt ErrorReporterFunction.Arn
          Type: 'Lambda'
    Properties:
      AutoPublishAlias: 'Live'
      CodeUri: 'other-bootstrap-file'
      FunctionName:
        'Fn::Sub': "${AWS::StackName}-my-lambda"
      Handler: 'UNUSED'
      LoggingConfig:
        ApplicationLogLevel: 'DEBUG'
        LogFormat: 'JSON'
        SystemLogLevel:
          Fn::FindInMap:
            - LambdaLogLevel
            - Ref: 'LogSeverity'
            - System
      MemorySize: 512
      Policies:
        - 'AWSLambdaBasicExecutionRole'
      Runtime: 'provided.al2'
      Timeout: 300
    Type: 'AWS::Serverless::Function'

Observed result

The processed template after deployment looks something like the following for MyFunction:

"MyFunction": {
      "Type": "AWS::Lambda::Function",
      "DependsOn": [
        "ValidationProducerFunctionLogGroup"
      ],
      "Properties": {
        "Code": {
          "S3Bucket": "<bucket-name>",
          "S3Key": "<bootstrap-hash>"
        },
        "FunctionName": {
          "Fn::Sub": "${AWS::StackName}-my-lambda"
        },
        "Handler": "UNUSED",
        "MemorySize": 512
}

No reference to the EventInvokeConfig exist anywhere in the processed template.

Deploying the following as a top level resource seems to work:

EventInvokeConfig:
    Type: AWS::Lambda::EventInvokeConfig
    Properties:
      FunctionName: !Ref MyFunction
      Qualifier: "Live"
      DestinationConfig:
        OnFailure:
          Destination: !GetAtt ErrorReporterFunction.Arn

Expected result

The transform should include my declared EventInvokeConfig in the processed template

Additional environment details

  1. OS: MacOs 14.4.1
  2. If using the SAM CLI, sam --version:
  3. AWS region: us-east-1
@Tristano8 Tristano8 added the stage/needs-triage Automatically applied to new issues and PRs, indicating they haven't been looked at. label May 27, 2024
@GavinZZ
Copy link
Contributor

GavinZZ commented Jun 3, 2024

In your function definition

MyFunction:
    EventInvokeConfig:
      DestinationConfig:
        OnFailure:
          Destination': !GetAtt ErrorReporterFunction.Arn
          Type: 'Lambda'
    Properties:
      AutoPublishAlias: 'Live'
      CodeUri: 'other-bootstrap-file'
      FunctionName:
        'Fn::Sub': "${AWS::StackName}-my-lambda"
      Handler: 'UNUSED'
      LoggingConfig:
        ApplicationLogLevel: 'DEBUG'
        LogFormat: 'JSON'
        SystemLogLevel:
          Fn::FindInMap:
            - LambdaLogLevel
            - Ref: 'LogSeverity'
            - System
      MemorySize: 512
      Policies:
        - 'AWSLambdaBasicExecutionRole'
      Runtime: 'provided.al2'
      Timeout: 300
    Type: 'AWS::Serverless::Function'

I believe you accidentally defined EventInvokeConfig outside of the properties. According to documentation, it should be under Properties

@GavinZZ
Copy link
Contributor

GavinZZ commented Jun 3, 2024

Going to mark this issue as resolved. Feel free to open a new issue if it doesn't fix it and we're happy to help.

@GavinZZ GavinZZ closed this as completed Jun 3, 2024
Copy link
Contributor

github-actions bot commented Jun 3, 2024

This issue is now closed. Comments on closed issues are hard for our team to see.
If you need more assistance, please either tag a team member or open a new issue that references this one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stage/needs-triage Automatically applied to new issues and PRs, indicating they haven't been looked at.
Projects
None yet
Development

No branches or pull requests

2 participants