uploadcare / uploadcare-ruby

Ruby API client that handles uploads and further operations with files by wrapping Uploadcare Upload and REST APIs.
https://uploadcare.com
MIT License
39 stars 28 forks source link

Error requiring "uploadcare" #90

Closed solidiquis closed 1 year ago

solidiquis commented 3 years ago

Requiring "uploadcare" is causing non-deterministic issues in our Heroku Rails app's build process. Here is the stack trace:

/gems/uploadcare-ruby-3.1.0/lib/uploadcare/client/project_client.rb:7 in <module:Client>
/gems/uploadcare-ruby-3.1.0/lib/uploadcare/client/project_client.rb:4 in <module:Uploadcare>
/gems/uploadcare-ruby-3.1.0/lib/uploadcare/client/project_client.rb:3 in <main>
/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23 in require
/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23 in block in require_with_bootsnap_lfi
/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/loaded_features_index.rb:92 in register
/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22 in require_with_bootsnap_lfi
/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:31 in require
/gems/activesupport-6.0.0/lib/active_support/dependencies.rb:325 in block in require
/gems/activesupport-6.0.0/lib/active_support/dependencies.rb:291 in load_dependency
/gems/activesupport-6.0.0/lib/active_support/dependencies.rb:325 in require
/gems/uploadcare-ruby-3.1.0/lib/uploadcare/entity/entity.rb:3 in block in <main>
/gems/uploadcare-ruby-3.1.0/lib/uploadcare/entity/entity.rb:3 in each
/gems/uploadcare-ruby-3.1.0/lib/uploadcare/entity/entity.rb:3 in <main>
/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23 in require
/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23 in block in require_with_bootsnap_lfi
/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/loaded_features_index.rb:92 in register
/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22 in require_with_bootsnap_lfi
/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:31 in require
/gems/activesupport-6.0.0/lib/active_support/dependencies.rb:325 in block in require
/gems/activesupport-6.0.0/lib/active_support/dependencies.rb:291 in load_dependency
/gems/activesupport-6.0.0/lib/active_support/dependencies.rb:325 in require
/gems/uploadcare-ruby-3.1.0/lib/uploadcare.rb:11 in <main>
/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23 in require
/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23 in block in require_with_bootsnap_lfi
/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/loaded_features_index.rb:92 in register
/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22 in require_with_bootsnap_lfi
/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:31 in require
/gems/activesupport-6.0.0/lib/active_support/dependencies.rb:325 in block in require
/gems/activesupport-6.0.0/lib/active_support/dependencies.rb:291 in load_dependency
/gems/activesupport-6.0.0/lib/active_support/dependencies.rb:325 in require
config/initializers/uploadcare_service.rb:1 in <main>

require 'uploadcare'
...

For whatever reason, this seems to only happen 20% of the time. Re-deploying seems to work, but this has gotten quite annoying.

I load uploadcare in my initializers like so:

config/initializers/uploadcare.rb

require 'uploadcare'

Uploadcare.config.public_key = ENV["UPLOADCARE_PUBLIC_KEY"]
Uploadcare.config.secret_key = ENV["UPLOADCARE_SECRET_KEY"]
kraft001 commented 1 year ago

@solidiquis It's quite an old bug, several new gem versions were published since it was raised. If you still experience similar issues, could you update the gem, please?

solidiquis commented 1 year ago

I did end up having to update this awhile back. Thanks for the quick response time :p