{"action":"created","issue":{"url":"https://api.github.com/repos/HyperBrain/serverless-aws-alias/issues/139","repository_url":"https://api.github.com/repos/HyperBrain/serverless-aws-alias","labels_url":"https://api.github.com/repos/HyperBrain/serverless-aws-alias/issues/139/labels{/name}","comments_url":"https://api.github.com/repos/HyperBrain/serverless-aws-alias/issues/139/comments","events_url":"https://api.github.com/repos/HyperBrain/serverless-aws-alias/issues/139/events","html_url":"https://github.com/HyperBrain/serverless-aws-alias/issues/139","id":368399570,"node_id":"MDU6SXNzdWUzNjgzOTk1NzA=","number":139,"title":"Two functions with two different stream event sources default to same event source","user":{"login":"austin43","id":12026053,"node_id":"MDQ6VXNlcjEyMDI2MDUz","avatar_url":"https://avatars0.githubusercontent.com/u/12026053?v=4","gravatar_id":"","url":"https://api.github.com/users/austin43","html_url":"https://github.com/austin43","followers_url":"https://api.github.com/users/austin43/followers","following_url":"https://api.github.com/users/austin43/following{/other_user}","gists_url":"https://api.github.com/users/austin43/gists{/gist_id}","starred_url":"https://api.github.com/users/austin43/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/austin43/subscriptions","organizations_url":"https://api.github.com/users/austin43/orgs","repos_url":"https://api.github.com/users/austin43/repos","events_url":"https://api.github.com/users/austin43/events{/privacy}","received_events_url":"https://api.github.com/users/austin43/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2018-10-09T21:10:52Z","updated_at":"2018-10-10T15:48:44Z","closed_at":null,"author_association":"NONE","body":"When two functions are created, The alias stack creates two different eventSourceMappings.  Each are bound to the first lambda function's stream.\r\n\r\n```\r\nhandler: lambdaOne/index.index\r\nrole: LambdaOneRole\r\nevents:\r\n  - stream: \r\n        Fn::ImportValue:\r\n            KinesisStreamArn-${self:provider.stage}\r\n```\r\n```\r\nhandler: lambdaTwo/index.index\r\nrole: LambdaTwoRole\r\nevents:\r\n  - stream:\r\n        Fn::ImportValue:\r\n            DynamodbStreamArn-${self:provider.stage}\r\n```\r\n```\r\n//cloudformation-template-update-alias-stack.json\r\n...\r\n    \"LambdaOneEventSourceMappingDynamodbMyTableStream\": {\r\n      \"Type\": \"AWS::Lambda::EventSourceMapping\",\r\n      \"DependsOn\": [\r\n        \"LambdaOneAlias\"\r\n      ],\r\n      \"Properties\": {\r\n        \"BatchSize\": 10,\r\n        \"EventSourceArn\": \"arn:aws:kinesis:us-east-1:ACCOUNT_ID:stream/myKinesisStream\",\r\n        \"FunctionName\": {\r\n          \"Ref\": \"LambdaOneAlias\"\r\n        },\r\n        \"StartingPosition\": \"TRIM_HORIZON\",\r\n        \"Enabled\": \"True\"\r\n      }\r\n    },\r\n    \"LambdaTwoEventSourceMappingKinesisMyKinesisStream\": {\r\n      \"Type\": \"AWS::Lambda::EventSourceMapping\",\r\n      \"DependsOn\": [\r\n        \"LambdaTwoAlias\"\r\n      ],\r\n      \"Properties\": {\r\n        \"BatchSize\": 10,\r\n        \"EventSourceArn\": \"arn:aws:kinesis:us-east-1:ACCOUNT_ID:stream/myKinesisStream\",\r\n        \"FunctionName\": {\r\n          \"Ref\": \"LambdaTwoAlias\"\r\n        },\r\n        \"StartingPosition\": \"TRIM_HORIZON\",\r\n        \"Enabled\": \"True\"\r\n      }\r\n    }\r\n```\r\n\r\nThis 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.\r\n\r\nserverless 1.32.0\r\nserverless-aws-alias 1.7.1\r\nplugins:\r\n  * serverless-aws-alias\r\n  * serverless-webpack"},"comment":{"url":"https://api.github.com/repos/HyperBrain/serverless-aws-alias/issues/comments/428625624","html_url":"https://github.com/HyperBrain/serverless-aws-alias/issues/139#issuecomment-428625624","issue_url":"https://api.github.com/repos/HyperBrain/serverless-aws-alias/issues/139","id":428625624,"node_id":"MDEyOklzc3VlQ29tbWVudDQyODYyNTYyNA==","user":{"login":"austin43","id":12026053,"node_id":"MDQ6VXNlcjEyMDI2MDUz","avatar_url":"https://avatars0.githubusercontent.com/u/12026053?v=4","gravatar_id":"","url":"https://api.github.com/users/austin43","html_url":"https://github.com/austin43","followers_url":"https://api.github.com/users/austin43/followers","following_url":"https://api.github.com/users/austin43/following{/other_user}","gists_url":"https://api.github.com/users/austin43/gists{/gist_id}","starred_url":"https://api.github.com/users/austin43/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/austin43/subscriptions","organizations_url":"https://api.github.com/users/austin43/orgs","repos_url":"https://api.github.com/users/austin43/repos","events_url":"https://api.github.com/users/austin43/events{/privacy}","received_events_url":"https://api.github.com/users/austin43/received_events","type":"User","site_admin":false},"created_at":"2018-10-10T15:48:44Z","updated_at":"2018-10-10T15:48:44Z","author_association":"NONE","body":"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."}}
{"actor":{"display_login":"austin43"}}