Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Please improve error handling for non-existent buckets #15

Open
RodneyMarable opened this issue Mar 9, 2019 · 2 comments
Open

Please improve error handling for non-existent buckets #15

RodneyMarable opened this issue Mar 9, 2019 · 2 comments

Comments

@RodneyMarable
Copy link

If I try to delete a stack with a non-existent bucket present in serverless.yml, serverless-s3-remover doesn't return an accurate error message:

$ aws s3 rb s3://test-bucket-rmarable --force
remove_bucket: test-bucket-rmarable

$ aws s3api head-bucket --bucket test-bucket-rmarable
An error occurred (404) when calling the HeadBucket operation: Not Found

$ sls remove
S3 Remover: Make test-bucket-rmarable empty. Are you sure? [yes/no]: yes
S3 Remover: Faild: test-bucket-rmarable may not be empty.

What should happen instead:

$ sls remove
S3 Remover: Make test-bucket-rmarable empty. Are you sure? [yes/no]: yes
S3 Remover: Faild: test-bucket-rmarable does not exist.

This issue was mentioned in #12 but doesn't seem to have been explicitly addressed.

Thanks for making this very useful plugin available.

@ajinabraham
Copy link

Related: #18

@coyoteecd
Copy link

@ajinabraham I know it's 2 years after, but for what is worth, I have reimplemented this plugin due to lack of response from maintainer and included a fix for your issue here as well. If the bucket does not exist, you get the following:

serverless-s3-cleaner: my-bucket not found or you do not have permissions, skipping...

Note the message is not 100% accurate because headBucket API call returns 403 if you do not have permissions to the bucket (even if the bucket does not exist). So I did not bother to do it more detailed due to the risk of being misleading.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants