BlobKey, MirrorService and Sidekiq 8 are incompatible
@const-cloudinary arbeitet bereits daran.
Seit 22.5.2025.
Bewertung
Dieses Issue wurde noch nicht bewertet.
Beschreibung
Bug report for Cloudinary Ruby SDK
Describe the bug in a sentence or two.
When using the Cloudinary ActiveStorage service in a mirror with S3 and Sidekiq 8 as a job queue, I am getting errors of the form
Job arguments to ActiveStorage::MirrorJob must be native JSON types, but "1xfiunhqeexf8h3pkdxucnby5eou" is a ActiveStorage::BlobKey
Issue Type (Can be multiple)
- Build - Cannot install or import the SDK
- Performance - Performance issues
- Behaviour - Functions are not working as expected (such as generate URL)
- Documentation - Inconsistency between the docs and behaviour
- Other (Specify)
Steps to reproduce
- Use Sidekiq 8 with strict_args enabled (default)
- Define an S3 service and a Cloudinary Service in storage.yml
- Define a mirror as
mirror:
service: Mirror
primary: amazon
mirrors:
- cloudinary
- Attempt to upload a file
- ActiveStorage will attempt to enqueue ActiveStorage::MirrorJob which takes
keyas an arg. But because the Cloudinary gem is redefining the key as aBlobKeywe get the above error from Sidekiq because BlobKey is not a native JSON type.
Error screenshots or Stack Trace (if applicable)
lib/active_storage/service/mirror_service.rb:55
A minimal repro can be achieved with the following:
> s = ActiveStorage::Service::MirrorService.new(primary: nil, mirrors: [])
=> #<ActiveStorage::Service::MirrorService:0x0000ffff69a5d2f0 @mirrors=[], @primary=nil>
> k = ActiveStorage::BlobKey.new(key: "test")
=> "test"
> s.mirror_later(k, checksum: nil)
INFO 2025-05-15T14:47:39.511Z pid=955 tid=25v: Sidekiq 8.0.3 connecting to Redis with options {size: 10, pool_name: "internal", url: "redis://redis:6379/0"}
Failed enqueuing ActiveStorage::MirrorJob to Sidekiq(default): ArgumentError (Job arguments to ActiveStorage::MirrorJob must be native JSON types, but "test" is a ActiveStorage::BlobKey.
See https://github.com/sidekiq/sidekiq/wiki/Best-Practices
To disable this error, add `Sidekiq.strict_args!(false)` to your initializer.
This monkey patch to ActiveStorage can address the issue, but I dont know whether rails would want this in their core code when the expect the key to be a string anyway
module ActiveStorage
class Service::MirrorService < Service
def mirror_later(key, checksum:) # :nodoc:
ActiveStorage::MirrorJob.perform_later key.to_s, checksum: checksum
end
end
end
Operating System
- Linux
- Windows
- macOS
- All
Environment and Libraries (fill in the version numbers)
- Cloudinary Ruby SDK version - 2.3.0
- Ruby Version - 3.4.3
- Rails Version - 7.2.2.1
- Other Libraries - ActiveStorage 7.2.2.1
- Vorherrschende Sprache
- Ruby
- Sterne
- 420
- Forks
- 282
- PR-Merge-Kennzahlen
- Keine gemergten PRs in 30 T.
Entwicklungsumgebung
- Kein Dockerfile und keine Docker-Compose-Datei
- Hat eine Pull-Request-Vorlage
- Beitragsleitfaden lesen
Erste Schritte
- Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
- Forken Sie das Repository und arbeiten Sie in einem Branch.
- Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.
Mehr aus cloudinary/cloudinary_gem
-
Schwierigkeit 4/5 3-5 Tage Anfängerfreundlichkeit 55/100
cloudinary/cloudinary_gem#597 · 1 Kommentar ·
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 52/100
cloudinary/cloudinary_gem#591 · 3 Kommentare ·
-
Schwierigkeit 3/5 1-2 Tage Anfängerfreundlichkeit 45/100
cloudinary/cloudinary_gem#582 · 1 Kommentar ·
-
404's when fetching .eml files (from Action Mailbox)Evtl. wieder frei @rnamba-cloudinary hat das vor 400 Tagen übernommen, und es ist kein Pull Request offen. Offen
Schwierigkeit 4/5 3-5 Tage Anfängerfreundlichkeit 30/100
cloudinary/cloudinary_gem#581 · 1 Kommentar ·
-
Schwierigkeit 4/5 3-5 Tage Anfängerfreundlichkeit 30/100
cloudinary/cloudinary_gem#562 · 9 Kommentare ·
Alle Issues in cloudinary/cloudinary_gem
Ähnliche Issues
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 65/100
metacall/core#964 · 1 Kommentar ·
Maintainer antworten meist innerhalb von 1 Tag
-
area: ci benchmark build developer-experience difficulty: easy dx enhancement github-actions good first issue hacktoberfest help wanted performance quality rank: 8 kyu ruby tech: ruby
Schwierigkeit 1/5 Unter einer Stunde Anfängerfreundlichkeit 82/100
flisk-sh/flisk-labs#22 ·
-
1.severity: security
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 62/100
Maintainer antworten meist innerhalb von 1 Tag
-
15-minutes 5-minutes algorithm any-language beginner-friendly c cpp csharp easy go good first issue hacktoberfest help wanted java javascript kotlin python rust swift typescript
Schwierigkeit 1/5 Unter einer Stunde Anfängerfreundlichkeit 68/100
Huerte/algo-solutions-python#260 ·
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 72/100
Maintainer antworten meist innerhalb von 1 Tag