From the docs it should be possible to deploy an eventSourceMapping from kinesis to a lambda function.
this is my definition:
functions:
myFunction:
handler: org.example.MyJavaClass
resources:
Resources:
myKinesisStream:
Type: AWS::Kinesis::Stream
Properties:
Name: myStreamInput
ShardCount: 1
myKinesisLambdaMapping:
Type: AWS::Lambda::EventSourceMapping
Properties:
EventSourceArn:
Fn::GetAtt:
- "myKinesisStream"
- "Arn"
FunctionName:
Fn::GetAtt:
- "myFunction"
- "Arn"
StartingPosition: "TRIM_HORIZON"
BatchSize: 10
the lambda function itself is ok and creates, the kinesis steam as well. just when I add the mapping it doesn’t work, as if the definition of the lambda function wasn’t known to the mapping factory, this error message is printed out:
# sls deploy
Serverless: Creating Stack...
Validation Error ---------------------------------------
Template error: instance of Fn::GetAtt references undefined
resource myFunction
For debugging logs, run again after setting SLS_DEBUG env var.
Stack Trace --------------------------------------------
ValidationError: Template error: instance of Fn::GetAtt references undefined resource myFunction
at Request.extractError (/home/oso/serverless/node_modules/aws-sdk/lib/protocol/query.js:40:29)
at Request.callListeners (/home/oso/serverless/node_modules/aws-sdk/lib/sequential_executor.js:105:20)
at Request.emit (/home/oso/serverless/node_modules/aws-sdk/lib/sequential_executor.js:77:10)
at Request.emit (/home/oso/serverless/node_modules/aws-sdk/lib/request.js:615:14)
at Request.transition (/home/oso/serverless/node_modules/aws-sdk/lib/request.js:22:10)
at AcceptorStateMachine.runTo (/home/oso/serverless/node_modules/aws-sdk/lib/state_machine.js:14:12)
at /home/oso/serverless/node_modules/aws-sdk/lib/state_machine.js:26:10
at Request.<anonymous> (/home/oso/serverless/node_modules/aws-sdk/lib/request.js:38:9)
at Request.<anonymous> (/home/oso/serverless/node_modules/aws-sdk/lib/request.js:617:12)
at Request.callListeners (/home/oso/serverless/node_modules/aws-sdk/lib/sequential_executor.js:115:18)
at Request.emit (/home/oso/serverless/node_modules/aws-sdk/lib/sequential_executor.js:77:10)
at Request.emit (/home/oso/serverless/node_modules/aws-sdk/lib/request.js:615:14)
at Request.transition (/home/oso/serverless/node_modules/aws-sdk/lib/request.js:22:10)
at AcceptorStateMachine.runTo (/home/oso/serverless/node_modules/aws-sdk/lib/state_machine.js:14:12)
at /home/oso/serverless/node_modules/aws-sdk/lib/state_machine.js:26:10
at Request.<anonymous> (/home/oso/serverless/node_modules/aws-sdk/lib/request.js:38:9)
I am pretty sure that I am missing just a small detail. Someone able to spot it?
The definition of the FunctionName seems to be the problematic part. AFAIK, the definition is created according to the documentation: SLS about event source mapping and AWS about event source mapping