craftship / codebox-npm

Serverless private npm registry using https://serverless.com/

Home Page:http://codebox.sh/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Stack removal fails because of non-empty S3 bucket

hassankhan opened this issue ยท comments

This is a Bug Report

Description

Ran sls remove --stage prod.

For bug reports:

  • What went wrong?
    The stack failed to delete.

  • What did you expect should have happened?
    The stack should have been deleted.

  • What was the config / env variables you used?

  • What stacktrace or error message did you
    experience?

$ sls remove --stage prod
Serverless: Getting all objects in S3 bucket...
Serverless: Removing objects in S3 bucket...
Serverless: Removing Stack...
Serverless: Checking Stack removal progress...
...........................................Serverless: Deployment failed!

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

     An error occurred while provisioning your stack: PackageStorage
     - The bucket you tried to delete is not empty.

  Get Support --------------------------------------------
     Docs:          docs.serverless.com
     Bugs:          github.com/serverless/serverless/issues

  Your Environment Information -----------------------------
     OS:                 darwin
     Node Version:       6.7.0
     Serverless Version: 1.6.1

Additional Data

  • NPM CLI version you are using: 3.10.3
  • Serverless version you're using: 1.6.1
  • Node version you're using: 6.7.0

Thanks for reporting this.

Will see what I can do about cleaning up the objects within the bucket before doing a remove (probably a .serverless_plugin if you empty the bucket manually the command should then work.

I did indeed do that, however for some reason CloudFormation didn't remove the S3 bucket and now its in a weird limbo state (not attached to any region and can't be deleted).

Also I agree, think a serverless plugin would be the way to go. The AWS-SDK doesn't seem to have a way to mass-delete objects, so you'd have to get a list of the objects then manually delete them ๐Ÿ˜ฆ

Yer I end up having to do this in the integration tests, it is a bit of a pain to be honest ๐Ÿ™ˆ - have some tech debt to tidy up the integration tests.

Having said that I think it should allow deleteBucket regardless of contents. Will check it out later ๐Ÿ‘

Just a heads up I have started this, needs a bit of tidy up and realised don't have tests for the .serverless_plugins ๐Ÿ™ˆ:
https://github.com/craftship/yith/blob/remove-storage-plugin/.serverless_plugins/remove-storage/index.js