Open austin43 opened 6 years ago
This appears to happen when you have defined roles for each lambda function separately. If the same permissions are placed in the default role, and I do not define explicit roles for my lambdas, it does not occur.
Tangentially, this also raises the question of why a default role is always expected by this plugin. If you do not use one, but have roles defined for each of your lambdas individually, serverless-aws-alias will fail with a message of: Cannot read property 'Properties' of undefined
https://github.com/HyperBrain/serverless-aws-alias/blob/master/lib/stackops/lambdaRole.js#L38
Should we be able to define the service with no default role?
This seems to be related to an undefined stack output showing up. The stack output for the first stream binding gets stored in the stack as undefined, so it binds each subsequent eventSourceMapping to the same undefined name, thus causing LambdaTwo to bind to the kinesis stream instead of dynamo. Looking into why this happens and if it's a bug that only shows up with the way we're using the plugin, but would appreciate some insight if anyone has any.
I am also seeing this behavior. If I reference the kinesis stream ARN using Fn::GetAtt
then those functions will have the correct event source mapping. However, if I reference the kinesis stream ARN directly or using some kind of custom variable, all functions will default to the same kinesis stream from the first.
When two functions are created, The alias stack creates two different eventSourceMappings. Each are bound to the first lambda function's stream.
This binding is correct in cloudformation-template-update-stack.json, but for some reason the first function stream binding is always bound in the alias. If I reverse the order of LambdaOne and LambdaTwo in serverless.yml, the dynamo stream is bound to both rather than kinesis.
serverless 1.32.0 serverless-aws-alias 1.7.1 plugins: