Can anyone help me find what's wrong?

I'm importing this cloudformation resources in my serverless yml. This is my function config:

Resources: eventHandler: Type: AWS::Serverless::Function Properties: CodeUri: eventLambda/ Handler: dist/app.eventHandler Runtime: nodejs12.x FunctionName: eventHandler 

This where I'm referencing it:

eventSourceRule: Type: 'AWS::Events::Rule' Properties: Name: eventSourceRule EventBusName: omnibus-${self:custom.stage} EventPattern: | { "source": ["op.api"] } RetryPolicy: MaximumRetryAttempts: 5 MaximumEventAgeInSeconds: 900 DeadLetterConfig: Type: SQS QueueLogicalId: EBRuleDLQ Targets: - Arn: Fn::GetAtt: - 'EventHandlerLambdaFunction' - 'Arn' Id: 'eventSourceRule' 

Notice that I've already tried eventHandler and EventHandler and none of these worked. That's the error I'm receiving:

The CloudFormation template is invalid: Template error: instance of Fn::GetAtt references undefined resource EventHandlerLambdaFunction 

1 Answer

I think you have to add the logical name of resource.
Replace EventHandlerLambdaFunction to actual resource name eventHandler.
You are not using the logical name of your Lambda resource you have defined.


You can try using the simple YAML syntax:

Targets: - Arn: !GetAtt eventHandler.Arn 

Reference: Fn::GetAtt AWS Documentation

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy