-
Notifications
You must be signed in to change notification settings - Fork 1
Open
Description
Summary
When using SolidQueue as the Active Job backend, logstruct raises a TypeError when logging job events:
Parameter 'provider_job_id': Can't set LogStruct::Log::ActiveJob::BaseFields.provider_job_id to 2905 (instance of Integer) - need a String
Root cause
LogStruct::Log::ActiveJob::BaseFieldstypesprovider_job_idasT.nilable(String)- SolidQueue sets
provider_job_idto an Integer (the database primary key of thesolid_queue_jobsrecord) LogStruct::Integrations::ActiveJob::LogSubscriber#build_base_fieldspassesjob.provider_job_iddirectly without conversion
Affected code
-
LogSubscriber (
integrations/active_job/log_subscriber.rb) line 86:provider_job_id: job.provider_job_id,
-
Builders::ActiveJob (
builders/active_job.rb)safe_provider_job_idreturns the raw value without.to_s
Suggested fix
Convert provider_job_id to a string in both places, since Active Job backends may return either String or Integer:
- In
build_base_fields:provider_job_id: job.provider_job_id&.to_s - In
safe_provider_job_id: returnraw&.to_sinstead ofraw
Workaround
Until fixed, we use an initializer that monkey-patches build_base_fields to call .to_s on provider_job_id.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels