Keep getting error - <resource> already exist


#1

I keep getting this error when I try to deploy a stack. Same deployment works on one computer and consistently fails on another. I read somewhere this could be cause by having similar function names, byt in my case I add a_, b_ c_ etc. to each function, and I still see the same error.

An error occurred while provisioning your stack: <function name>LogGroup
     - /aws/lambda/<stage>-<function name> already exists.

  Your Environment Information -----------------------------
     OS:                 win32
     Node Version:       6.9.0
     Serverless Version: 1.8.0

I upgraded from 1.6 to latest 1.8, but still same issue.
Any suggestion of how to fix this


#2

By playing around with ‘DependsOn’ (although there really isn’t any dependencies) I’m able to get the deployment working - for now.


#3

“To fix this breaking change, simply delete the old log group, or rename your service if you must keep the old logs.”

I believe this will solve your issue


#4

Hitting this issue again.
This time I have 2 users, userA, userB, both belonging to the same admin group.
deploying with userA’s credential works.
deploying with userB’s credentials consistently fails (on the same computer) with this error

  Serverless Error ---------------------------------------

     An error occurred while provisioning your stack: IamRoleLambdaExecution
     - <name>-us-east-1-lambdaRole already exists.

  Your Environment Information -----------------------------
     OS:                 win32
     Node Version:       6.9.4
     Serverless Version: 1.8.0

Any suggestions ?

Edit: I manually went in and deleted all resources related to the failed deployment and after that I could deploy successful.


#5

Running into exact same issue. Was hoping to see some response.

Serverless Error ---------------------------------------
 
  An error occurred: IamRoleLambdaExecution - testlambda-dev-us-east-1-lambdaRole already exists.
 
  Get Support --------------------------------------------
     Docs:          docs.serverless.com
     Bugs:          github.com/serverless/serverless/issues
     Forums:        forum.serverless.com
     Chat:          gitter.im/serverless/serverless
 
  Your Environment Information -----------------------------
     OS:                     linux
     Node Version:           9.5.0
     Serverless Version:     1.26.0

#6

I manually went in and deleted all resources related to the failed deployment and after that I could deploy successful.

@rakesh-k You might need to sls remove and redeploy.


#7

An additional approach that may help, at least on AWS, is going into Cloud Formation and identifying the resources that can’t delete/update/create. Then, attach the policies through IAM necessary to allow your serverless user to delete/modify/update/create those resources.

For me, the problem with using a separate user was that the privileges for that user were different. The error messaging through serverless did not fully direct me to the scope of the privileges missing to modify the existing resource, but AWS Cloud Formation gave additional detail.