Rails/Paperclip/S3 mystery errors: undefined method “global_endpoint?”

让人想犯罪 __ 提交于 2019-12-11 05:05:54

问题


So I upgraded a Rails app from 3.0 to 4.0 last week, and ever since I've been getting strange errors that seem to point to random places that I haven't changed, and I can't reproduce them.

One such error is like this:

NoMethodError: undefined method `global_endpoint?' for AWS::S3:Class

[GEM_ROOT]/gems/aws-sdk-1.46.0/lib/aws/core/configuration.rb:441

/gems/aws-sdk-1.46.0/lib/aws/core/configuration.rb:441 in "block in add_service"
/gems/aws-sdk-1.46.0/lib/aws/core/configuration.rb:361 in "call"
/gems/aws-sdk-1.46.0/lib/aws/core/configuration.rb:361 in "block in add_option"
/gems/aws-sdk-1.46.0/lib/aws/core/configuration.rb:381 in "block (2 levels) in add_option_with_needs"
/gems/aws-sdk-1.46.0/lib/aws/core/configuration.rb:381 in "each"
/gems/aws-sdk-1.46.0/lib/aws/core/configuration.rb:381 in "inject"
/gems/aws-sdk-1.46.0/lib/aws/core/configuration.rb:381 in "block in add_option_with_needs"
/gems/aws-sdk-1.46.0/lib/aws/core/service_interface.rb:73 in "initialize"
/gems/paperclip-4.1.1/lib/paperclip/storage/s3.rb:239 in "new"
/gems/paperclip-4.1.1/lib/paperclip/storage/s3.rb:239 in "obtain_s3_instance_for"
/gems/paperclip-4.1.1/lib/paperclip/storage/s3.rb:233 in "s3_interface"
/gems/paperclip-4.1.1/lib/paperclip/storage/s3.rb:243 in "s3_bucket"
/gems/paperclip-4.1.1/lib/paperclip/storage/s3.rb:247 in "s3_object"
/app/models/my_model.rb:49 in "block in my_download_url"

This will randomly occur on a page that has a model with a paperclip attachment saved on S3. Reloading the page will sometimes cause it again, but usually it will reload properly without incident.

I don't know what to do to debug it, since I can't even get it to happen at will.

Any help or ideas?


回答1:


Solved it! Only took a year and a half of searching! Turns out it's related to some bad memory hooks in the libxml-ruby gem. See here:

https://github.com/sparklemotion/nokogiri/issues/881 https://github.com/sparklemotion/nokogiri/issues/1364

Removing libxml-ruby from my Gemfile fixed it.



来源:https://stackoverflow.com/questions/24666164/rails-paperclip-s3-mystery-errors-undefined-method-global-endpoint

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!