question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

CREATE_FAILED LambdaDataSourceRole AWS::IAM::Role already exists in stack *FunctionDirectiveStack*

See original GitHub issue

Describe 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:

  1. Create two serverless functions as seperated project
  2. deploy the serverless project
  3. try to call this functions using the schema.graphql
  4. See error

Expected behaviour The stack gets published without an AWS::IAM::Role already exists error.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:1
  • Comments:10 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
kaustavghosh06commented, Oct 22, 2019

Yeah. Will discuss with the team and make the change. Closing this as it’s a duplicate of #2468

1reaction
kaustavghosh06commented, Oct 22, 2019

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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Resolve the "Custom Named Resource already exists in stack ...
My AWS CloudFormation stack fails to create a resource, and I receive an error message telling me that my resource already exists in...
Read more >
"Already exists in stack" error when attempting to re-deploy a ...
It correctly packages, uploads, and checks cloudformation for the update, but fails every time because the function seems to already exist. Any ...
Read more >
How to re-deploy stack when getting 'resource already exists ...
I experienced this issue myself and contacted AWS support. It seems that CloudFormation associates the logical ID with the resource, ...
Read more >
Resource already exists - Seed.run
Serverless failed to deploy because it tried to create a resource with the specified name, and a resource with that name already exists...
Read more >
Already exists in stack arn:aws:cloudformation error | Resolved
Frustrated with "already exists in stack" arn:aws:cloudformation error? Find out what our skilled Support Engineers suggest. Click to read.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found