CREATE_FAILED LambdaDataSourceRole AWS::IAM::Role already exists in stack *FunctionDirectiveStack*
See original GitHub issueDescribe the bug I have a two AWS Projects, one is deployed with serverless (API Functions) The other project is deployed using the amplify-cli.
amplify --version
3.0.0
Now I try to add two functions from the serverless function stack to the amplify grapql shema.
type Mutation {
createTask(relationId: String, task: String): String @function(name: "amplify-postTask")
}
type Mutation {
createComment(relationtId: String, comment: String): String @function(name: "amplify-postComment")
}
The first function gets successfully added to the API. When I add any other function from the same serverless project. The amplify push fails on create a AWS::IAM::Role
CREATE_FAILED ApiAmplifyCreateCommentLambdaDataSourceRole AWS::IAM::Role Tue Oct 22 2019 11:16:00 GMT+0200 (CEST) ManagerApiAmplif-vrfnhtkignam5ikmhbnrmokf4a-dev already exists in stack arn:aws:cloudformation:eu-west-1:*removed*:stack/manager-amplify-dev-20191021235616-apimanagerAmplifyApi-1L6WIZZ-FunctionDirectiveStack-T83KE07FL2WX/821bbb40-f44f-11e9-a8af-0afa58e29f3e
To Reproduce Steps to reproduce the behavior:
- Create two serverless functions as seperated project
- deploy the serverless project
- try to call this functions using the schema.graphql
- See error
Expected behaviour The stack gets published without an AWS::IAM::Role already exists error.
Issue Analytics
- State:
- Created 4 years ago
- Reactions:1
- Comments:10 (5 by maintainers)
Yeah. Will discuss with the team and make the change. Closing this as it’s a duplicate of #2468
To be precise, only if the first 26 characters of your two functions are the same - only then you’ll see the name clashes - We do this to prevent IAM role name character limit.