jeygeethan / activestorage-backblaze

Looking for co-committers. Pls reach out. Activestorage (rails 6) gem for using backblaze b2 as the storage (just like aws s3 etc)
26 stars 10 forks source link

Fog Error - Service unavailable, no tomes available #7

Open DorianGreen1 opened 3 years ago

DorianGreen1 commented 3 years ago

Hello,

I'm attempting to store ~4000 records via a rake task both create an image attachment and a variant per record in active storage and received this error about halfway through (meaning 2000 records made it to backblaze). Could you help determine if this is a bug or a mistake in my implementation? thank you

ERROR - 101

<Fog::Errors::Error: Failed put_object, status = 503 {"code"=>"service_unavailable", "message"=>"no tomes available", "status"=>503}>

rake aborted! ActiveStorage::IntegrityError: ActiveStorage::IntegrityError /Users/john/.rvm/gems/ruby-2.5.3/gems/activestorage-backblaze-0.0.5/lib/active_storage/service/backblaze_service.rb:28:in rescue in block in upload' /Users/john/.rvm/gems/ruby-2.5.3/gems/activestorage-backblaze-0.0.5/lib/active_storage/service/backblaze_service.rb:21:inblock in upload' /Users/john/.rvm/gems/ruby-2.5.3/gems/activesupport-6.0.4/lib/active_support/notifications.rb:180:in block in instrument' /Users/john/.rvm/gems/ruby-2.5.3/gems/activesupport-6.0.4/lib/active_support/notifications/instrumenter.rb:24:ininstrument' /Users/john/.rvm/gems/ruby-2.5.3/gems/activesupport-6.0.4/lib/active_support/notifications.rb:180:in instrument' /Users/john/.rvm/gems/ruby-2.5.3/gems/activestorage-6.0.4/lib/active_storage/service.rb:127:ininstrument' /Users/john/.rvm/gems/ruby-2.5.3/gems/activestorage-backblaze-0.0.5/lib/active_storage/service/backblaze_service.rb:20:in upload' /Users/john/.rvm/gems/ruby-2.5.3/gems/activestorage-6.0.4/app/models/active_storage/variant.rb:109:inupload' /Users/john/.rvm/gems/ruby-2.5.3/gems/activestorage-6.0.4/app/models/active_storage/variant.rb:100:in block (2 levels) in process' /Users/john/.rvm/gems/ruby-2.5.3/gems/activestorage-6.0.4/lib/active_storage/transformers/transformer.rb:28:intransform' /Users/john/.rvm/gems/ruby-2.5.3/gems/activestorage-6.0.4/app/models/active_storage/variation.rb:52:in block in transform' /Users/john/.rvm/gems/ruby-2.5.3/gems/activesupport-6.0.4/lib/active_support/notifications.rb:182:ininstrument' /Users/john/.rvm/gems/ruby-2.5.3/gems/activestorage-6.0.4/app/models/active_storage/variation.rb:51:in transform' /Users/john/.rvm/gems/ruby-2.5.3/gems/activestorage-6.0.4/app/models/active_storage/variant.rb:105:intransform' /Users/john/.rvm/gems/ruby-2.5.3/gems/activestorage-6.0.4/app/models/active_storage/variant.rb:100:in block in process' /Users/john/.rvm/gems/ruby-2.5.3/gems/activestorage-6.0.4/lib/active_storage/downloader.rb:15:inblock in open' /Users/john/.rvm/gems/ruby-2.5.3/gems/activestorage-6.0.4/lib/active_storage/downloader.rb:24:in open_tempfile' /Users/john/.rvm/gems/ruby-2.5.3/gems/activestorage-6.0.4/lib/active_storage/downloader.rb:12:inopen' /Users/john/.rvm/gems/ruby-2.5.3/gems/activestorage-6.0.4/lib/active_storage/service.rb:87:in open' /Users/john/.rvm/gems/ruby-2.5.3/gems/activestorage-6.0.4/app/models/active_storage/blob.rb:217:inopen' /Users/john/.rvm/gems/ruby-2.5.3/gems/activestorage-6.0.4/app/models/active_storage/variant.rb:99:in process' /Users/john/.rvm/gems/ruby-2.5.3/gems/activestorage-6.0.4/app/models/active_storage/variant.rb:67:inprocessed' /Users/john/code/ror/app_api/lib/tasks/createObjects.rake:331:in block (2 levels) in <top (required)>' /Users/john/code/ror/app_api/lib/tasks/createObjects.rake:11:ineach' /Users/john/code/ror/app_api/lib/tasks/createObjects.rake:11:in each_with_index' /Users/john/code/ror/app_api/lib/tasks/createObjects.rake:11:inblock in <top (required)>' /Users/john/.rvm/gems/ruby-2.5.3/gems/rake-13.0.4/exe/rake:27:in <top (required)>' /Users/john/.rvm/gems/ruby-2.5.3/bin/ruby_executable_hooks:24:ineval' /Users/john/.rvm/gems/ruby-2.5.3/bin/ruby_executable_hooks:24:in `

'

Caused by: Fog::Errors::Error: Failed put_object, status = 503 {"code"=>"service_unavailable", "message"=>"no tomes available", "status"=>503} /Users/john/.rvm/gems/ruby-2.5.3/gems/fog-backblaze-0.3.0/lib/fog/backblaze/storage/real.rb:223:in put_object' /Users/john/.rvm/gems/ruby-2.5.3/gems/activestorage-backblaze-0.0.5/lib/active_storage/service/backblaze_service.rb:24:inblock in upload' /Users/john/.rvm/gems/ruby-2.5.3/gems/activesupport-6.0.4/lib/active_support/notifications.rb:180:in block in instrument' /Users/john/.rvm/gems/ruby-2.5.3/gems/activesupport-6.0.4/lib/active_support/notifications/instrumenter.rb:24:ininstrument' /Users/john/.rvm/gems/ruby-2.5.3/gems/activesupport-6.0.4/lib/active_support/notifications.rb:180:in instrument' /Users/john/.rvm/gems/ruby-2.5.3/gems/activestorage-6.0.4/lib/active_storage/service.rb:127:ininstrument' /Users/john/.rvm/gems/ruby-2.5.3/gems/activestorage-backblaze-0.0.5/lib/active_storage/service/backblaze_service.rb:20:in upload' /Users/john/.rvm/gems/ruby-2.5.3/gems/activestorage-6.0.4/app/models/active_storage/variant.rb:109:inupload' /Users/john/.rvm/gems/ruby-2.5.3/gems/activestorage-6.0.4/app/models/active_storage/variant.rb:100:in block (2 levels) in process' /Users/john/.rvm/gems/ruby-2.5.3/gems/activestorage-6.0.4/lib/active_storage/transformers/transformer.rb:28:intransform' /Users/john/.rvm/gems/ruby-2.5.3/gems/activestorage-6.0.4/app/models/active_storage/variation.rb:52:in block in transform' /Users/john/.rvm/gems/ruby-2.5.3/gems/activesupport-6.0.4/lib/active_support/notifications.rb:182:ininstrument' /Users/john/.rvm/gems/ruby-2.5.3/gems/activestorage-6.0.4/app/models/active_storage/variation.rb:51:in transform' /Users/john/.rvm/gems/ruby-2.5.3/gems/activestorage-6.0.4/app/models/active_storage/variant.rb:105:intransform' /Users/john/.rvm/gems/ruby-2.5.3/gems/activestorage-6.0.4/app/models/active_storage/variant.rb:100:in block in process' /Users/john/.rvm/gems/ruby-2.5.3/gems/activestorage-6.0.4/lib/active_storage/downloader.rb:15:inblock in open' /Users/john/.rvm/gems/ruby-2.5.3/gems/activestorage-6.0.4/lib/active_storage/downloader.rb:24:in open_tempfile' /Users/john/.rvm/gems/ruby-2.5.3/gems/activestorage-6.0.4/lib/active_storage/downloader.rb:12:inopen' /Users/john/.rvm/gems/ruby-2.5.3/gems/activestorage-6.0.4/lib/active_storage/service.rb:87:in open' /Users/john/.rvm/gems/ruby-2.5.3/gems/activestorage-6.0.4/app/models/active_storage/blob.rb:217:inopen' /Users/john/.rvm/gems/ruby-2.5.3/gems/activestorage-6.0.4/app/models/active_storage/variant.rb:99:in process' /Users/john/.rvm/gems/ruby-2.5.3/gems/activestorage-6.0.4/app/models/active_storage/variant.rb:67:inprocessed' /Users/john/code/ror/app_api/lib/tasks/createObjects.rake:331:in block (2 levels) in <top (required)>' /Users/john/code/ror/app_api/lib/tasks/createObjects.rake:11:ineach' /Users/john/code/ror/app_api/lib/tasks/createObjects.rake:11:in each_with_index' /Users/john/code/ror/app_api/lib/tasks/createObjects.rake:11:inblock in <top (required)>' /Users/john/.rvm/gems/ruby-2.5.3/gems/rake-13.0.4/exe/rake:27:in <top (required)>' /Users/john/.rvm/gems/ruby-2.5.3/bin/ruby_executable_hooks:24:ineval' /Users/john/.rvm/gems/ruby-2.5.3/bin/ruby_executable_hooks:24:in `

' Tasks: TOP => createObjects (See full trace by running task with --trace)

line 331 in the mentioned rake task is imgSuffix = Rails.application.routes.url_helpers.rails_representation_url(object.image.variant(resize: "100x100").processed, only_path: true) prior to that line I call object.image.attach(io: File.open(imageFilePath), filename: fileName + ".jpg")

Thank you,