You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm in a development environment running Sidekiq for ActiveJob. I am uploading an image to GCS, and while the upload appears to be working, I get an error in the background process with Sidekiq:
2024-04-07T22:26:12.045Z pid=83252 tid=9g0 INFO: Performing ActiveStorage::AnalyzeJob (Job ID: 6577da28-1888-4829-9555-15713470c9be) from Sidekiq(default) enqueued at 2024-04-07T22:25:23.428248000Z with arguments: #<GlobalID:0x000000014185d440 @uri=#<URI::GID gid://funabiki-online/ActiveStorage::Blob/19959>> 2024-04-07T22:26:12.196Z pid=83252 tid=9g0 INFO: GCS Storage (148.7ms) Downloaded file from key: pxzjm0zpghoz066siyph4gfoa4yi 2024-04-07T22:26:12.197Z pid=83252 tid=9g0 ERROR: Error performing ActiveStorage::AnalyzeJob (Job ID: 6577da28-1888-4829-9555-15713470c9be) from Sidekiq(default) in 175.79ms: NoMethodError (undefined method header' for nil):
*/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/google-cloud-storage-1.49.0/lib/google/cloud/storage/file.rb:1054:in download' */.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/activestorage-7.1.3.2/lib/active_storage/service/gcs_service.rb:186:in stream'
*/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/activestorage-7.1.3.2/lib/active_storage/service/gcs_service.rb:37:in block in download' */.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/activesupport-7.1.3.2/lib/active_support/notifications.rb:206:in block in instrument'
*/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/activesupport-7.1.3.2/lib/active_support/notifications/instrumenter.rb:58:in instrument' */.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/activesupport-7.1.3.2/lib/active_support/notifications.rb:206:in instrument'
*/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/activestorage-7.1.3.2/lib/active_storage/service.rb:165:in instrument' */.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/activestorage-7.1.3.2/lib/active_storage/service/gcs_service.rb:36:in download'
*/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/activestorage-7.1.3.2/lib/active_storage/downloader.rb:32:in download' */.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/activestorage-7.1.3.2/lib/active_storage/downloader.rb:13:in block in open'
*/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/activestorage-7.1.3.2/lib/active_storage/downloader.rb:24:in open_tempfile' */.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/activestorage-7.1.3.2/lib/active_storage/downloader.rb:12:in open'
*/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/activestorage-7.1.3.2/lib/active_storage/service.rb:92:in open' */.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/activestorage-7.1.3.2/app/models/active_storage/blob.rb:290:in open'
*/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/activestorage-7.1.3.2/lib/active_storage/analyzer.rb:35:in download_blob_to_tempfile' */.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/activestorage-7.1.3.2/lib/active_storage/analyzer/image_analyzer/vips.rb:20:in read_image'
*/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/activestorage-7.1.3.2/lib/active_storage/analyzer/image_analyzer.rb:20:in metadata' */.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/activestorage-7.1.3.2/app/models/active_storage/blob/analyzable.rb:52:in extract_metadata_via_analyzer'
*/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/activestorage-7.1.3.2/app/models/active_storage/blob/analyzable.rb:30:in analyze' */.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/activestorage-7.1.3.2/app/jobs/active_storage/analyze_job.rb:11:in perform'
*/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/activejob-7.1.3.2/lib/active_job/execution.rb:69:in block in _perform_job'
This download_file call is resulting in 'nil'. But, if I go into IRB and check, the file is correctly attached to my model and I can get an url that is accessible. Likewise, in my dev environment the image loads and the record has be persisted. It's just this Analyze callback that is causing issues. I thought it was a race conditions error so I tried setting Sidekiq to inline processing but the issue still comes up (this time returning an error to the user instead of within the Sidekiq background process).
I wasn't sure exactly where to post this, as various gems are involved (ActiveStorage, SideKiq, ActiveJob, GCS), so thanks in advance if you're reading this.
[edit:] Confirmed error in production as well. I have been uploading PDFs in the past, and jpgs and haven't had problems.
The text was updated successfully, but these errors were encountered:
I think he was having the same error as me. It was being fed to sidekiq or some background async service, and then the analysis was failing and soft_deleting the file, hence the related error here. I could be wrong, but this also popped up a few days ago, so I suspect it's related.
Confirmed that downgrading to 1.37.0 fixed this issue for now.
google-cloud-ruby/google-cloud-storage/lib/google/cloud/storage/file.rb
Line 1078 in 77be955
I'm in a development environment running Sidekiq for ActiveJob. I am uploading an image to GCS, and while the upload appears to be working, I get an error in the background process with Sidekiq:
2024-04-07T22:26:12.045Z pid=83252 tid=9g0 INFO: Performing ActiveStorage::AnalyzeJob (Job ID: 6577da28-1888-4829-9555-15713470c9be) from Sidekiq(default) enqueued at 2024-04-07T22:25:23.428248000Z with arguments: #<GlobalID:0x000000014185d440 @uri=#<URI::GID gid://funabiki-online/ActiveStorage::Blob/19959>> 2024-04-07T22:26:12.196Z pid=83252 tid=9g0 INFO: GCS Storage (148.7ms) Downloaded file from key: pxzjm0zpghoz066siyph4gfoa4yi 2024-04-07T22:26:12.197Z pid=83252 tid=9g0 ERROR: Error performing ActiveStorage::AnalyzeJob (Job ID: 6577da28-1888-4829-9555-15713470c9be) from Sidekiq(default) in 175.79ms: NoMethodError (undefined method
header' for nil):*/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/google-cloud-storage-1.49.0/lib/google/cloud/storage/file.rb:1054:in
download' */.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/activestorage-7.1.3.2/lib/active_storage/service/gcs_service.rb:186:in
stream'*/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/activestorage-7.1.3.2/lib/active_storage/service/gcs_service.rb:37:in
block in download' */.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/activesupport-7.1.3.2/lib/active_support/notifications.rb:206:in
block in instrument'*/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/activesupport-7.1.3.2/lib/active_support/notifications/instrumenter.rb:58:in
instrument' */.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/activesupport-7.1.3.2/lib/active_support/notifications.rb:206:in
instrument'*/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/activestorage-7.1.3.2/lib/active_storage/service.rb:165:in
instrument' */.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/activestorage-7.1.3.2/lib/active_storage/service/gcs_service.rb:36:in
download'*/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/activestorage-7.1.3.2/lib/active_storage/downloader.rb:32:in
download' */.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/activestorage-7.1.3.2/lib/active_storage/downloader.rb:13:in
block in open'*/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/activestorage-7.1.3.2/lib/active_storage/downloader.rb:24:in
open_tempfile' */.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/activestorage-7.1.3.2/lib/active_storage/downloader.rb:12:in
open'*/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/activestorage-7.1.3.2/lib/active_storage/service.rb:92:in
open' */.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/activestorage-7.1.3.2/app/models/active_storage/blob.rb:290:in
open'*/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/activestorage-7.1.3.2/lib/active_storage/analyzer.rb:35:in
download_blob_to_tempfile' */.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/activestorage-7.1.3.2/lib/active_storage/analyzer/image_analyzer/vips.rb:20:in
read_image'*/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/activestorage-7.1.3.2/lib/active_storage/analyzer/image_analyzer.rb:20:in
metadata' */.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/activestorage-7.1.3.2/app/models/active_storage/blob/analyzable.rb:52:in
extract_metadata_via_analyzer'*/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/activestorage-7.1.3.2/app/models/active_storage/blob/analyzable.rb:30:in
analyze' */.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/activestorage-7.1.3.2/app/jobs/active_storage/analyze_job.rb:11:in
perform'*/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/activejob-7.1.3.2/lib/active_job/execution.rb:69:in
block in _perform_job'
Tracing it back to:
google-cloud-ruby/google-cloud-storage/lib/google/cloud/storage/service.rb
Line 579 in 77be955
This download_file call is resulting in 'nil'. But, if I go into IRB and check, the file is correctly attached to my model and I can get an url that is accessible. Likewise, in my dev environment the image loads and the record has be persisted. It's just this Analyze callback that is causing issues. I thought it was a race conditions error so I tried setting Sidekiq to inline processing but the issue still comes up (this time returning an error to the user instead of within the Sidekiq background process).
I wasn't sure exactly where to post this, as various gems are involved (ActiveStorage, SideKiq, ActiveJob, GCS), so thanks in advance if you're reading this.
[edit:] Confirmed error in production as well. I have been uploading PDFs in the past, and jpgs and haven't had problems.
The text was updated successfully, but these errors were encountered: