{"action":"created","issue":{"url":"https://api.github.com/repos/serverless/serverless/issues/2717","repository_url":"https://api.github.com/repos/serverless/serverless","labels_url":"https://api.github.com/repos/serverless/serverless/issues/2717/labels{/name}","comments_url":"https://api.github.com/repos/serverless/serverless/issues/2717/comments","events_url":"https://api.github.com/repos/serverless/serverless/issues/2717/events","html_url":"https://github.com/serverless/serverless/issues/2717","id":189463479,"number":2717,"title":"Can't subscribe to S3 events on a bucket in CF Stack","user":{"login":"asprouse","id":428120,"avatar_url":"https://avatars.githubusercontent.com/u/428120?v=3","gravatar_id":"","url":"https://api.github.com/users/asprouse","html_url":"https://github.com/asprouse","followers_url":"https://api.github.com/users/asprouse/followers","following_url":"https://api.github.com/users/asprouse/following{/other_user}","gists_url":"https://api.github.com/users/asprouse/gists{/gist_id}","starred_url":"https://api.github.com/users/asprouse/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/asprouse/subscriptions","organizations_url":"https://api.github.com/users/asprouse/orgs","repos_url":"https://api.github.com/users/asprouse/repos","events_url":"https://api.github.com/users/asprouse/events{/privacy}","received_events_url":"https://api.github.com/users/asprouse/received_events","type":"User","site_admin":false},"labels":[{"id":417327117,"url":"https://api.github.com/repos/serverless/serverless/labels/kind/bug","name":"kind/bug","color":"FF8C94","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":11,"created_at":"2016-11-15T18:01:43Z","updated_at":"2016-11-30T17:06:19Z","closed_at":null,"body":"<!--\r\n1. If you have a question and not a bug/feature request please ask it at http://forum.serverless.com\r\n2. Please check if an issue already exists so there are no duplicates\r\n3. Check out and follow our Guidelines: https://github.com/serverless/serverless/blob/master/CONTRIBUTING.md\r\n4. Fill out the whole template so we have a good overview on the issue\r\n5. Do not remove any section of the template. If something is not applicable leave it empty but leave it in the Issue\r\n6. Please follow the template, otherwise we'll have to ask you to update it\r\n-->\r\n\r\n# This is a Bug Report\r\n\r\n## Description\r\nI know @flomotlik weighed in (#2154) on attaching events to s3 buckets not created by Cloudformation. I am having this issue with an s3 bucket that IS in the Cloudformation stack but it was created in the `resources` section of the `serverless.yml`:\r\n\r\n```yml\r\nfunctions:\r\n upload-hook:\r\n    handler: api/upload-hook/index.handler\r\n    events:\r\n      - s3:\r\n          bucket: ${self:service}.${self:custom.stage}.assets\r\n          event: s3:ObjectCreated:*\r\n\r\nresources:\r\n  Resources:\r\n    AssetsBucket:\r\n      Type: AWS::S3::Bucket\r\n      Properties:\r\n        AccessControl: Private\r\n        BucketName: \"${self:service}.${self:custom.stage}.assets\"\r\n        CorsConfiguration:\r\n          CorsRules:\r\n          - AllowedOrigins:\r\n              - http://example.dev:3001\r\n            AllowedHeaders:\r\n              - \"*\"\r\n            AllowedMethods:\r\n              - PUT\r\n              - GET\r\n          - AllowedOrigins:\r\n              - https://dev.example.com\r\n            AllowedHeaders:\r\n              - \"*\"\r\n            AllowedMethods:\r\n              - PUT\r\n              - GET\r\n```\r\nIt seems that there are two sections in the `cloudformation-template-update-stack.json` one is named `S3BucketExampleapidevassets` and the other is named `AssetsBucket`. It seems that these should get merged by serverless.\r\n\r\n```\r\nServerless Error ---------------------------------------\r\n \r\n     An error occurred while provisioning your stack: S3BucketExampleapidevassets\r\n     - example-api.dev.assets already exists in stack arn:aws:cloudformation:us-east-1:xxxxxx:stack/example-api-dev/de90bc30-aaa2-11e6-bd9e-500c20fafe62.\r\n \r\n  Get Support --------------------------------------------\r\n     Docs:          docs.serverless.com\r\n     Bugs:          github.com/serverless/serverless/issues\r\n \r\n  Your Environment Information -----------------------------\r\n     OS:                 darwin\r\n     Node Version:       7.0.0\r\n     Serverless Version: 1.1.0\r\n```\r\n"},"comment":{"url":"https://api.github.com/repos/serverless/serverless/issues/comments/263931668","html_url":"https://github.com/serverless/serverless/issues/2717#issuecomment-263931668","issue_url":"https://api.github.com/repos/serverless/serverless/issues/2717","id":263931668,"user":{"login":"nachoab","id":1003790,"avatar_url":"https://avatars.githubusercontent.com/u/1003790?v=3","gravatar_id":"","url":"https://api.github.com/users/nachoab","html_url":"https://github.com/nachoab","followers_url":"https://api.github.com/users/nachoab/followers","following_url":"https://api.github.com/users/nachoab/following{/other_user}","gists_url":"https://api.github.com/users/nachoab/gists{/gist_id}","starred_url":"https://api.github.com/users/nachoab/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nachoab/subscriptions","organizations_url":"https://api.github.com/users/nachoab/orgs","repos_url":"https://api.github.com/users/nachoab/repos","events_url":"https://api.github.com/users/nachoab/events{/privacy}","received_events_url":"https://api.github.com/users/nachoab/received_events","type":"User","site_admin":false},"created_at":"2016-11-30T17:06:19Z","updated_at":"2016-11-30T17:06:19Z","body":"I had to modify  `lib/plugins/aws/deploy/compile/events/s3/index.js` here  https://github.com/nachoab/serverless/commit/77ba504e9c480ec45ec7c89f39957ba6154b80f3\r\nuntil we know how to do this.\r\n\r\nWith that change I can reference a Bucket from s3 events using it's name without sls attempting to create the bucket ignoring my resource definition"}}
{"actor":{"display_login":"nachoab"}}