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.

Using KeyPrefix does not delete the s3 bucket after "sls remove" command.

See original GitHub issue

This is a:

  • [] Feature request or change
  • Bug report

For bug reports:

Expected behavior

“sls remove” should remove the bucket

Actual behavior

objects was deleted but the bucket remains, although it is empty but in a long run it will pile up on my aws account.

Steps to reproduce

Added KeyPrefix to yml file.

custom:
   client:
     keyPrefix: 'samplepref'

Below is the result of “remove” command. Screen Shot 2022-01-18 at 3 33 34 PM

I think this block of code has something to do with the behavior. Screen Shot 2022-01-18 at 3 38 11 PM

  • **Operating system:osx
  • **serverless-finch version:2.8.0
  • serverless.yml that produces bug:
  • Command that produces bug:
  • Other details:

For feature requests or changes:

Current behavior (if any)

Proposed behavior

Proposed implementation deatils (optional)

Justification

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
fernando-mccommented, Feb 28, 2022

@mikejpeters - I also prefer clean sensible defaults so as long as we release this with a major version bump I’m fine with it. I agree it probably makes sense and there’s aren’t many people who would object to it but it does change default behavior destructively and there’s always some weird use cases we can’t predict.

When including this:

  1. Add a warning to release notes
  2. Bump a major version

Then we’re covering our bases and should be fine.

1reaction
mikejpeterscommented, Feb 28, 2022

Thanks for the response. I’m assuming you wouldn’t want this plugin to delete the bucket if there are still other objects i (e.g. in your case feature branches)?

@fernando-mc can you weigh in on this again when you have a chance? If the plugin deletes the objects at the prefix, and then only deletes the bucket if it’s completely empty I don’t see a downside. But maybe I’m missing some danger / use case? Having a new option like “force remove bucket” is safer but IMO less user-friendly. I like having smart defaults / less options, even if it means releasing a new major version with breaking changes

Read more comments on GitHub >

github_iconTop Results From Across the Web

Cannot deploy/remove stack because S3 bucket is gone
I just ran into a situation where sls remove (1.17.0) failed to remove my ... After deleting the Stack manually using the AWS...
Read more >
How to delete the CloudFormation stack - Serverless Forums
Step 1. sls remove. Which deleted only the S3 bucket where lambda jar was deployed. Other S3 bucket had data in it so...
Read more >
AWS::S3::Bucket - AWS CloudFormation
You can only delete empty buckets. Deletion fails for buckets that have contents. Syntax. To declare this entity in your AWS CloudFormation template,...
Read more >
Deleting S3 files with a given prefix only
I'm assigned a job where I've to delete files which have a specific prefix. There are around 300,000 files with the given prefix...
Read more >
Destroy resources created via Serverless without ...
The Serverless Framework uses AWS CloudFormation under the hood. So deleting things manually is no good idea. Just keep in mind: Resources ...
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