删除 AWS/S3 存储桶时出现类型错误

发布于 2024-12-10 11:03:34 字数 1368 浏览 0 评论 0原文

我不确定为什么删除存储桶时会出现类型错误。下面是我在 ruby​​ 控制台中输入的命令:

AWS::S3::Bucket.delete('my_bucket', :force => true)

然后我得到了一堆错误:

TypeError: can't convert Time into String
from /Users/Kinglee/.rvm/gems/ruby-1.9.2-p180@rails3tutorial/gems/aws-s3-0.6.2/lib/aws/s3/object.rb:300:in `join'
from /Users/Kinglee/.rvm/gems/ruby-1.9.2-p180@rails3tutorial/gems/aws-s3-0.6.2/lib/aws/s3/object.rb:300:in `path!'
from /Users/Kinglee/.rvm/gems/ruby-1.9.2-p180@rails3tutorial/gems/aws-s3-0.6.2/lib/aws/s3/object.rb:223:in `delete'
from /Users/Kinglee/.rvm/gems/ruby-1.9.2-p180@rails3tutorial/gems/aws-s3-0.6.2/lib/aws/s3/object.rb:547:in `delete'
from /Users/Kinglee/.rvm/gems/ruby-1.9.2-p180@rails3tutorial/gems/aws-s3-0.6.2/lib/aws/s3/bucket.rb:275:in `block in delete_all'
from /Users/Kinglee/.rvm/gems/ruby-1.9.2-p180@rails3tutorial/gems/aws-s3-0.6.2/lib/aws/s3/bucket.rb:253:in `each'
from /Users/Kinglee/.rvm/gems/ruby-1.9.2-p180@rails3tutorial/gems/aws-s3-0.6.2/lib/aws/s3/bucket.rb:253:in `each'
from /Users/Kinglee/.rvm/gems/ruby-1.9.2-p180@rails3tutorial/gems/aws-s3-0.6.2/lib/aws/s3/bucket.rb:274:in `delete_all'
from /Users/Kinglee/.rvm/gems/ruby-1.9.2-p180@rails3tutorial/gems/aws-s3-0.6.2/lib/aws/s3/bucket.rb:160:in `delete'
from (irb):19
from /Users/Kinglee/.rvm/rubies/ruby-1.9.2-p180/bin/irb:16:in `'

需要帮助,谢谢!

I am not sure why I am getting a TypeError for deleting a bucket. Below is the command I typed into the ruby console:

AWS::S3::Bucket.delete('my_bucket', :force => true)

then I got this bunch of errors:

TypeError: can't convert Time into String
from /Users/Kinglee/.rvm/gems/ruby-1.9.2-p180@rails3tutorial/gems/aws-s3-0.6.2/lib/aws/s3/object.rb:300:in `join'
from /Users/Kinglee/.rvm/gems/ruby-1.9.2-p180@rails3tutorial/gems/aws-s3-0.6.2/lib/aws/s3/object.rb:300:in `path!'
from /Users/Kinglee/.rvm/gems/ruby-1.9.2-p180@rails3tutorial/gems/aws-s3-0.6.2/lib/aws/s3/object.rb:223:in `delete'
from /Users/Kinglee/.rvm/gems/ruby-1.9.2-p180@rails3tutorial/gems/aws-s3-0.6.2/lib/aws/s3/object.rb:547:in `delete'
from /Users/Kinglee/.rvm/gems/ruby-1.9.2-p180@rails3tutorial/gems/aws-s3-0.6.2/lib/aws/s3/bucket.rb:275:in `block in delete_all'
from /Users/Kinglee/.rvm/gems/ruby-1.9.2-p180@rails3tutorial/gems/aws-s3-0.6.2/lib/aws/s3/bucket.rb:253:in `each'
from /Users/Kinglee/.rvm/gems/ruby-1.9.2-p180@rails3tutorial/gems/aws-s3-0.6.2/lib/aws/s3/bucket.rb:253:in `each'
from /Users/Kinglee/.rvm/gems/ruby-1.9.2-p180@rails3tutorial/gems/aws-s3-0.6.2/lib/aws/s3/bucket.rb:274:in `delete_all'
from /Users/Kinglee/.rvm/gems/ruby-1.9.2-p180@rails3tutorial/gems/aws-s3-0.6.2/lib/aws/s3/bucket.rb:160:in `delete'
from (irb):19
from /Users/Kinglee/.rvm/rubies/ruby-1.9.2-p180/bin/irb:16:in `'

Need help, thanks!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

云淡月浅 2024-12-17 11:03:34

我无法回答你的具体问题,但我可以说我对那颗宝石有很多问题。

我建议您改用 rightaws gem:

http://rightaws.rubyforge.org/right_aws_gem_doc/

它还可以做很多更酷的事情,例如列出存储桶中的文件夹。

I can't answer your specifici problem, but I can say that I've had lots of issues with that gem.

I'd suggest you use the rightaws gem instead:

http://rightaws.rubyforge.org/right_aws_gem_doc/

it can also do a lot more cool stuff like listing folders in a bucket.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文