{"action":"created","issue":{"url":"https://api.github.com/repos/serverless/serverless/issues/2233","repository_url":"https://api.github.com/repos/serverless/serverless","labels_url":"https://api.github.com/repos/serverless/serverless/issues/2233/labels{/name}","comments_url":"https://api.github.com/repos/serverless/serverless/issues/2233/comments","events_url":"https://api.github.com/repos/serverless/serverless/issues/2233/events","html_url":"https://github.com/serverless/serverless/issues/2233","id":179740387,"number":2233,"title":"Not possible to create resources that depend on the ApiGateway::Deployment","user":{"login":"alexanderbh","id":172970,"avatar_url":"https://avatars.githubusercontent.com/u/172970?v=3","gravatar_id":"","url":"https://api.github.com/users/alexanderbh","html_url":"https://github.com/alexanderbh","followers_url":"https://api.github.com/users/alexanderbh/followers","following_url":"https://api.github.com/users/alexanderbh/following{/other_user}","gists_url":"https://api.github.com/users/alexanderbh/gists{/gist_id}","starred_url":"https://api.github.com/users/alexanderbh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alexanderbh/subscriptions","organizations_url":"https://api.github.com/users/alexanderbh/orgs","repos_url":"https://api.github.com/users/alexanderbh/repos","events_url":"https://api.github.com/users/alexanderbh/events{/privacy}","received_events_url":"https://api.github.com/users/alexanderbh/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/serverless/serverless/labels/help-wanted","name":"help-wanted","color":"0e8a16"}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":3,"created_at":"2016-09-28T10:52:01Z","updated_at":"2016-09-28T19:58:52Z","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\n\r\nFor bug reports:\r\n* What went wrong?\r\n\r\nI am creating a custom resource `AWS::ApiGateway::BasePathMapping` like this:\r\n```\r\npathmapping:\r\n    Type: AWS::ApiGateway::BasePathMapping\r\n    Properties:\r\n        BasePath: oauth2\r\n        DomainName: ${self:custom.domainName}\r\n        RestApiId: \r\n          Ref: ApiGatewayRestApi\r\n        Stage: ${self:custom.stage}\r\n```\r\n\r\nBut the Cloudformation stack fails. It fails because the BasePathMapping requires the API to be deployed but it does not depend on the `AWS::ApiGateway::Deployment`\r\n\r\n* What did you expect should have happened?\r\n\r\nThe cloudformation stack should not fail. The BasePathMapping should be able to depend on the Deployment.\r\n\r\n* What was the config you used?\r\n\r\nServerless RC2\r\n\r\n* What stacktrace or error message from your provider did you see?\r\n\r\n> Invalid stage identifier specified\r\n\r\n\r\n## Additional Data\r\n\r\n* ***Serverless Framework Version you're using***: RC2\r\n\r\n* ***Operating System***: Mac OS X\r\n\r\n* ***Stack Trace***: None. The cloudformation stack is fine but fails to update.\r\n\r\n* ***Provider Error messages***:\r\n\r\nThis is the error from CloudFormation when creating the BasePathMapping\r\n> Invalid stage identifier specified\r\n\r\n\r\n## Workaround\r\n\r\nIt is not possible to DependsOn the deployment because the logical name of the deployment contains a random number (based on the time in ms).\r\n\r\nI just tried to copy the entire cloudformation stack json and change the logical name of the deployment to ApiGatewayDeployment and then make my BasePathMapping DependsOn that and now it works.\r\n\r\nThis is not a good workaround because it defeats the purpose of sls.\r\n\r\nThe way I got around it to depend on an ApiKey since they are named with a sequental number.\r\nSo I create an ApiKey in the provider section:\r\n```\r\nprovider:\r\n    apiKeys:\r\n        - workaroundkey\r\n```\r\n\r\nAnd then I can make my BasePathMapping depend on this:\r\n\r\n```\r\npathmapping:\r\n    Type: AWS::ApiGateway::BasePathMapping\r\n    DependsOn: ApiGatewayApiKey1\r\n    Properties:\r\n        BasePath: oauth2\r\n        DomainName: ${self:custom.domainName}\r\n        RestApiId: \r\n          Ref: ApiGatewayRestApi\r\n        Stage: ${self:custom.stage}\r\n```\r\n\r\n\r\n### Regression\r\nThe unique number was introduced in https://github.com/serverless/serverless/pull/1761\r\n\r\nBefore that it was possible to DependsOn the logical name of the Deployment."},"comment":{"url":"https://api.github.com/repos/serverless/serverless/issues/comments/250281939","html_url":"https://github.com/serverless/serverless/issues/2233#issuecomment-250281939","issue_url":"https://api.github.com/repos/serverless/serverless/issues/2233","id":250281939,"user":{"login":"alexanderbh","id":172970,"avatar_url":"https://avatars.githubusercontent.com/u/172970?v=3","gravatar_id":"","url":"https://api.github.com/users/alexanderbh","html_url":"https://github.com/alexanderbh","followers_url":"https://api.github.com/users/alexanderbh/followers","following_url":"https://api.github.com/users/alexanderbh/following{/other_user}","gists_url":"https://api.github.com/users/alexanderbh/gists{/gist_id}","starred_url":"https://api.github.com/users/alexanderbh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alexanderbh/subscriptions","organizations_url":"https://api.github.com/users/alexanderbh/orgs","repos_url":"https://api.github.com/users/alexanderbh/repos","events_url":"https://api.github.com/users/alexanderbh/events{/privacy}","received_events_url":"https://api.github.com/users/alexanderbh/received_events","type":"User","site_admin":false},"created_at":"2016-09-28T19:58:52Z","updated_at":"2016-09-28T19:58:52Z","body":"It is not possible to use a function in DependsOn. DependsOn must be a string or a list of strings. I had made the mapping solution but it does not work when I try to use the Fn::FindInMap as DependsOn.\r\n\r\nI am going to try to fix the force-redeploy instead. It would be more clean to remove the random number than working around it with maps."}}
{"actor":{"display_login":"alexanderbh"}}