{"action":"created","issue":{"url":"https://api.github.com/repos/serverless/serverless/issues/4711","repository_url":"https://api.github.com/repos/serverless/serverless","labels_url":"https://api.github.com/repos/serverless/serverless/issues/4711/labels{/name}","comments_url":"https://api.github.com/repos/serverless/serverless/issues/4711/comments","events_url":"https://api.github.com/repos/serverless/serverless/issues/4711/events","html_url":"https://github.com/serverless/serverless/issues/4711","id":294078286,"number":4711,"title":"Cannot reference an authorizer already created within services that shares the same API GW","user":{"login":"mpaleo","id":5132565,"avatar_url":"https://avatars1.githubusercontent.com/u/5132565?v=4","gravatar_id":"","url":"https://api.github.com/users/mpaleo","html_url":"https://github.com/mpaleo","followers_url":"https://api.github.com/users/mpaleo/followers","following_url":"https://api.github.com/users/mpaleo/following{/other_user}","gists_url":"https://api.github.com/users/mpaleo/gists{/gist_id}","starred_url":"https://api.github.com/users/mpaleo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mpaleo/subscriptions","organizations_url":"https://api.github.com/users/mpaleo/orgs","repos_url":"https://api.github.com/users/mpaleo/repos","events_url":"https://api.github.com/users/mpaleo/events{/privacy}","received_events_url":"https://api.github.com/users/mpaleo/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":5,"created_at":"2018-02-03T03:06:13Z","updated_at":"2018-04-11T12:12:36Z","closed_at":null,"author_association":"NONE","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\n* What went wrong?\r\nI have two services (e.g. Service-A and Service-B) that shares the same API Gateway. Service-A has some public/private endpoints and defines an API GW authorizer. This works fine.\r\nService-B has some private endpoints that need to use the authorizer defined in Service-A. I tried to reference the authorizer by ARN with no success. I think the problem is that serverless tries to create another authorizer in the same API GW, and throws error because an authorizer with the same name already exists. The thing is that I dont want to create another API GW authorizer, I just want to reference an authorizer that belongs to the API GW.\r\nOutput relevant to Service-A\r\n```json\r\n{\r\n    \"AuthorizerApiGatewayAuthorizer\":{\r\n        \"Type\":\"AWS::ApiGateway::Authorizer\",\r\n        \"Properties\":{\r\n            \"AuthorizerResultTtlInSeconds\":0,\r\n            \"IdentitySource\":\"method.request.header.Authorization\",\r\n            \"Name\":\"authorizer\",\r\n            \"RestApiId\":\"XXXXXXXX\",\r\n            \"AuthorizerUri\":{\r\n                \"Fn::Join\":[\r\n                    \"\",\r\n                    [\r\n                        \"arn:aws:apigateway:\",\r\n                        {\r\n                            \"Ref\":\"AWS::Region\"\r\n                        },\r\n                        \":lambda:path/2015-03-31/functions/\",\r\n                        {\r\n                            \"Fn::GetAtt\":[\r\n                                \"AuthorizerLambdaFunction\",\r\n                                \"Arn\"\r\n                            ]\r\n                        },\r\n                        \"/invocations\"\r\n                    ]\r\n                ]\r\n            },\r\n            \"Type\":\"TOKEN\"\r\n        }\r\n    }\r\n}\r\n```\r\nOutput relevant to Service-B\r\n```json\r\n{\r\n    \"AuthorizerApiGatewayAuthorizer\":{\r\n        \"Type\":\"AWS::ApiGateway::Authorizer\",\r\n        \"Properties\":{\r\n            \"IdentitySource\":\"method.request.header.Authorization\",\r\n            \"Name\":\"authorizer\",\r\n            \"RestApiId\":\"XXXXXXXX\",\r\n            \"AuthorizerUri\":{\r\n                \"Fn::Join\":[\r\n                    \"\",\r\n                    [\r\n                        \"arn:aws:apigateway:\",\r\n                        {\r\n                            \"Ref\":\"AWS::Region\"\r\n                        },\r\n                        \":lambda:path/2015-03-31/functions/\",\r\n                        \"MY_LAMBDA_FUNCTION_AUTHORIZER_ARN\",\r\n                        \"/invocations\"\r\n                    ]\r\n                ]\r\n            },\r\n            \"Type\":\"TOKEN\"\r\n        }\r\n    }\r\n}\r\n```\r\n* What did you expect should have happened?\r\nHaving Service-A and Service-B within the same API GW, I expect to be able to reference the authorizer already defined by Service-A.\r\n* What was the config you used?\r\nI have tried this alternatives in Service-B\r\n```yml\r\nfunctions:\r\n some-function:\r\n   handler: someHandler.someFunction\r\n   events:\r\n     - http:\r\n         path: some/path\r\n         method: get\r\n         authorizer:\r\n           arn: LAMBDA_ARN\r\n           name: service-a-authorizer-name\r\n```\r\n```yml\r\nfunctions:\r\n some-function:\r\n   handler: someHandler.someFunction\r\n   events:\r\n     - http:\r\n         path: some/path\r\n         method: get\r\n         authorizer: LAMBDA_ARN\r\n```\r\n* What stacktrace or error message from your provider did you see?\r\nAn error occurred: AuthorizerApiGatewayAuthorizer - Authorizer name must be unique. Authorizer authorizer already exists in this RestApi..\r\n\r\n## Additional Data\r\n\r\n* ***Serverless Framework Version you're using***: 1.26\r\n* ***Operating System***: Linux (kernel 4.13.0-32-generic)\r\n* ***Stack Trace***:\r\n* ***Provider Error messages***: \r\n"},"comment":{"url":"https://api.github.com/repos/serverless/serverless/issues/comments/380429866","html_url":"https://github.com/serverless/serverless/issues/4711#issuecomment-380429866","issue_url":"https://api.github.com/repos/serverless/serverless/issues/4711","id":380429866,"user":{"login":"jacintoArias","id":7511199,"avatar_url":"https://avatars0.githubusercontent.com/u/7511199?v=4","gravatar_id":"","url":"https://api.github.com/users/jacintoArias","html_url":"https://github.com/jacintoArias","followers_url":"https://api.github.com/users/jacintoArias/followers","following_url":"https://api.github.com/users/jacintoArias/following{/other_user}","gists_url":"https://api.github.com/users/jacintoArias/gists{/gist_id}","starred_url":"https://api.github.com/users/jacintoArias/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jacintoArias/subscriptions","organizations_url":"https://api.github.com/users/jacintoArias/orgs","repos_url":"https://api.github.com/users/jacintoArias/repos","events_url":"https://api.github.com/users/jacintoArias/events{/privacy}","received_events_url":"https://api.github.com/users/jacintoArias/received_events","type":"User","site_admin":false},"created_at":"2018-04-11T12:12:36Z","updated_at":"2018-04-11T12:12:36Z","author_association":"NONE","body":"Has anybody tested this PR to solve this issue? #4197\r\n\r\nI know it only references COGNITO_USER_POOLS but perhaps it might work as well with Custom authorizers..."}}
{"actor":{"display_login":"jacintoArias"}}