You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Unsuccessful stack creates being seen as successful in certain scenarios #2087
If the initial CREATE of the stack fails and successfully rolls back, sls thinks the CREATE succeeded and continues on when it shouldn't. You can recreate this by using an AWS user that doesn't have s3:CreateBucket permission. The initial bucket will fail to create, then the stack will successfully rollback. But sls thinks the operation was successful and continues on.
Since the user I was using didn't have the correct AWS perms, the bucket had a CREATE_FAILED. I'd expect it to detect that even though it successfully completed in the sense it successfully deleted itself (aka rolled back), it did not successfully create the stack and thus future commands are going to fail. So fail right when the stack is done rolling back.
Additional Data
_Serverless Framework Version you're using_: 1.0.0-rc.1
_Operating System_: Mac
_Stack Trace_: Above
_Provider Error messages_: It complained that it couldn't create the bucket because of my AWS perms, which is expected.
In my testing for this problem, I also discovered an intermittent race-condition - sometimes the CREATE_FAILED bucket error happens in-between the polling interval, so sls doesn't know why the stack is being deleted.
Fixing the original issue seems to be a simple as adding DELETE_COMPLETE to the list of invalidStatuses (which could probably be more appropriately named failureStatuses - they're completely valid CFN statuses, just indicative of a failure), as that's the status an initial failed deployment due to lack of S3 permissions ends up with.
Handling the race condition (when sls never sees the error) would be considerably harder and more complex. @flomotlik are you happy with just a fix for the reported bug?
Imho we should change the onFailure behaviour of the create-stack call from Delete to Do_Nothing or Rollback because I think the Delete is causing more trouble than its worth. It hides the stack and makes debugging much harder.
Then this bug and the race condition you mentioned should also be gone
@flomotlik I like it; It will make failures easier to troubleshoot (because you'll be able to see the results immediately in the console), and it will remove this (and future similar) race conditions.
The minimum for exact part where it borked for me is simply a s3:CreateBucket. But if you're looking for the minimum for SLS to do it's full suite of things, there are some tickets around where I think people figured that out. I think this comment on #1439 may be the most thorough I've seen.
To be more direct about your question though, I ended up with a hacky troposphere script to create my user with the set of perms that I needed. For the full suite of perms SLS needs for everything it does, start with that above comment.
Activity
flomotlik commentedon Sep 12, 2016
Yup thanks for reporting. Definitely a bug that needs to be fixed!
rowanu commentedon Sep 13, 2016
In my testing for this problem, I also discovered an intermittent race-condition - sometimes the
CREATE_FAILEDbucket error happens in-between the polling interval, soslsdoesn't know why the stack is being deleted.Fixing the original issue seems to be a simple as adding
DELETE_COMPLETEto the list ofinvalidStatuses(which could probably be more appropriately namedfailureStatuses- they're completely valid CFN statuses, just indicative of a failure), as that's the status an initial failed deployment due to lack of S3 permissions ends up with.Handling the race condition (when
slsnever sees the error) would be considerably harder and more complex. @flomotlik are you happy with just a fix for the reported bug?flomotlik commentedon Sep 13, 2016
Imho we should change the onFailure behaviour of the create-stack call from
DeletetoDo_NothingorRollbackbecause I think the Delete is causing more trouble than its worth. It hides the stack and makes debugging much harder.Then this bug and the race condition you mentioned should also be gone
rowanu commentedon Sep 13, 2016
@flomotlik I like it; It will make failures easier to troubleshoot (because you'll be able to see the results immediately in the console), and it will remove this (and future similar) race conditions.
I will PR.
M1chaelTran commentedon Sep 21, 2016
@colbywhite how did you end up resolving the error?
CREATE_FAILED - AWS::S3::Bucket - ServerlessDeploymentBucketWhat is the minimum permission required for it to work?
colbywhite commentedon Sep 21, 2016
The minimum for exact part where it borked for me is simply a
s3:CreateBucket. But if you're looking for the minimum for SLS to do it's full suite of things, there are some tickets around where I think people figured that out. I think this comment on #1439 may be the most thorough I've seen.To be more direct about your question though, I ended up with a hacky troposphere script to create my user with the set of perms that I needed. For the full suite of perms SLS needs for everything it does, start with that above comment.
ilyakatz commentedon Oct 4, 2016
so is it required to have
s3:CreateBucketpermissions to be able to deploy? Does the deploy create a new bucket for each deploy?