Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

I18n::InvalidLocale "en" is not a valid locale #544

Closed
martijnenco opened this issue Mar 29, 2025 · 11 comments
Closed

I18n::InvalidLocale "en" is not a valid locale #544

martijnenco opened this issue Mar 29, 2025 · 11 comments

Comments

@martijnenco
Copy link

Problem: I am trying to have recuring jobs, and I have them configured like this:

# config/recurring.yml
'DailyInstagramPost':
  command: "InstagramPostJob.perform_later if Rails.env.production?"
  schedule: "at 12pm every day"

Valid locals are configured in my application.rb:

    config.i18n.default_locale = 'nl-NL'
    config.i18n.available_locales = ['nl-NL', 'en-GB']

Results in the current error as seen in mission control:

Error information
I18n::InvalidLocale "en" is not a valid locale

/usr/local/bundle/gems/i18n-1.14.7/lib/i18n.rb:382:in `enforce_available_locales!'
/usr/local/bundle/gems/i18n-1.14.7/lib/i18n/config.rb:15:in `locale='
/usr/local/bundle/gems/i18n-1.14.7/lib/i18n.rb:75:in `locale='
/usr/local/bundle/gems/i18n-1.14.7/lib/i18n.rb:351:in `with_locale'
/usr/local/bundle/gems/activejob-7.2.2.1/lib/active_job/translation.rb:9:in `block (2 levels) in <module:Translation>'
/usr/local/bundle/gems/activesupport-7.2.2.1/lib/active_support/callbacks.rb:130:in `instance_exec'
/usr/local/bundle/gems/activesupport-7.2.2.1/lib/active_support/callbacks.rb:130:in `block in run_callbacks'
/usr/local/bundle/gems/activesupport-7.2.2.1/lib/active_support/core_ext/time/zones.rb:65:in `use_zone'
/usr/local/bundle/gems/activejob-7.2.2.1/lib/active_job/timezones.rb:9:in `block (2 levels) in <module:Timezones>'
/usr/local/bundle/gems/activesupport-7.2.2.1/lib/active_support/callbacks.rb:130:in `instance_exec'
/usr/local/bundle/gems/activesupport-7.2.2.1/lib/active_support/callbacks.rb:130:in `block in run_callbacks'
/usr/local/bundle/gems/activesupport-7.2.2.1/lib/active_support/callbacks.rb:141:in `run_callbacks'
/usr/local/bundle/gems/activejob-7.2.2.1/lib/active_job/execution.rb:67:in `_perform_job'
/usr/local/bundle/gems/activejob-7.2.2.1/lib/active_job/instrumentation.rb:32:in `_perform_job'
/usr/local/bundle/gems/activejob-7.2.2.1/lib/active_job/execution.rb:51:in `perform_now'
/usr/local/bundle/gems/activejob-7.2.2.1/lib/active_job/instrumentation.rb:26:in `block in perform_now'
/usr/local/bundle/gems/activerecord-7.2.2.1/lib/active_record/railties/job_runtime.rb:13:in `block in instrument'
/usr/local/bundle/gems/activejob-7.2.2.1/lib/active_job/instrumentation.rb:40:in `block in instrument'
/usr/local/bundle/gems/activesupport-7.2.2.1/lib/active_support/notifications.rb:210:in `block in instrument'
/usr/local/bundle/gems/activesupport-7.2.2.1/lib/active_support/notifications/instrumenter.rb:58:in `instrument'
/usr/local/bundle/gems/sentry-rails-5.23.0/lib/sentry/rails/tracing.rb:56:in `instrument'
/usr/local/bundle/gems/activesupport-7.2.2.1/lib/active_support/notifications.rb:210:in `instrument'
/usr/local/bundle/gems/activejob-7.2.2.1/lib/active_job/instrumentation.rb:39:in `instrument'
/usr/local/bundle/gems/activerecord-7.2.2.1/lib/active_record/railties/job_runtime.rb:11:in `instrument'
/usr/local/bundle/gems/activejob-7.2.2.1/lib/active_job/instrumentation.rb:26:in `perform_now'
/usr/local/bundle/gems/activejob-7.2.2.1/lib/active_job/logging.rb:32:in `block in perform_now'
/usr/local/bundle/gems/activesupport-7.2.2.1/lib/active_support/tagged_logging.rb:138:in `block in tagged'
/usr/local/bundle/gems/activesupport-7.2.2.1/lib/active_support/tagged_logging.rb:38:in `tagged'
/usr/local/bundle/gems/activesupport-7.2.2.1/lib/active_support/tagged_logging.rb:138:in `tagged'
/usr/local/bundle/gems/activesupport-7.2.2.1/lib/active_support/broadcast_logger.rb:241:in `method_missing'
/usr/local/bundle/gems/activejob-7.2.2.1/lib/active_job/logging.rb:39:in `tag_logger'
/usr/local/bundle/gems/activejob-7.2.2.1/lib/active_job/logging.rb:32:in `perform_now'
/usr/local/bundle/gems/sentry-rails-5.23.0/lib/sentry/rails/active_job.rb:11:in `block in perform_now'
/usr/local/bundle/gems/sentry-rails-5.23.0/lib/sentry/rails/active_job.rb:43:in `block in record'
/usr/local/bundle/gems/sentry-ruby-5.23.0/lib/sentry/hub.rb:89:in `with_scope'
/usr/local/bundle/gems/sentry-ruby-5.23.0/lib/sentry-ruby.rb:408:in `with_scope'
/usr/local/bundle/gems/sentry-rails-5.23.0/lib/sentry/rails/active_job.rb:26:in `record'
/usr/local/bundle/gems/sentry-rails-5.23.0/lib/sentry/rails/active_job.rb:10:in `perform_now'
/usr/local/bundle/gems/activejob-7.2.2.1/lib/active_job/execution.rb:29:in `block in execute'
/usr/local/bundle/gems/activesupport-7.2.2.1/lib/active_support/callbacks.rb:121:in `block in run_callbacks'
/usr/local/bundle/gems/activejob-7.2.2.1/lib/active_job/railtie.rb:79:in `block (4 levels) in <class:Railtie>'
/usr/local/bundle/gems/activesupport-7.2.2.1/lib/active_support/reloader.rb:77:in `block in wrap'
/usr/local/bundle/gems/activesupport-7.2.2.1/lib/active_support/execution_wrapper.rb:87:in `wrap'
/usr/local/bundle/gems/activesupport-7.2.2.1/lib/active_support/reloader.rb:74:in `wrap'
/usr/local/bundle/gems/activejob-7.2.2.1/lib/active_job/railtie.rb:78:in `block (3 levels) in <class:Railtie>'
/usr/local/bundle/gems/activesupport-7.2.2.1/lib/active_support/callbacks.rb:130:in `instance_exec'
/usr/local/bundle/gems/activesupport-7.2.2.1/lib/active_support/callbacks.rb:130:in `block in run_callbacks'
/usr/local/bundle/gems/activesupport-7.2.2.1/lib/active_support/callbacks.rb:141:in `run_callbacks'
/usr/local/bundle/gems/activejob-7.2.2.1/lib/active_job/execution.rb:27:in `execute'
/usr/local/bundle/gems/solid_queue-1.1.4/app/models/solid_queue/claimed_execution.rb:95:in `execute'
/usr/local/bundle/gems/solid_queue-1.1.4/app/models/solid_queue/claimed_execution.rb:61:in `perform'
/usr/local/bundle/gems/solid_queue-1.1.4/lib/solid_queue/pool.rb:23:in `block (2 levels) in post'
/usr/local/bundle/gems/activesupport-7.2.2.1/lib/active_support/execution_wrapper.rb:91:in `wrap'
/usr/local/bundle/gems/solid_queue-1.1.4/lib/solid_queue/app_executor.rb:7:in `wrap_in_app_executor'
/usr/local/bundle/gems/solid_queue-1.1.4/lib/solid_queue/pool.rb:22:in `block in post'
/usr/local/bundle/gems/concurrent-ruby-1.3.5/lib/concurrent-ruby/concurrent/promises.rb:1593:in `evaluate_to'
/usr/local/bundle/gems/concurrent-ruby-1.3.5/lib/concurrent-ruby/concurrent/promises.rb:1776:in `block in on_resolvable'
/usr/local/bundle/gems/concurrent-ruby-1.3.5/lib/concurrent-ruby/concurrent/executor/ruby_thread_pool_executor.rb:359:in `run_task'
/usr/local/bundle/gems/concurrent-ruby-1.3.5/lib/concurrent-ruby/concurrent/executor/ruby_thread_pool_executor.rb:350:in `block (3 levels) in create_worker'
/usr/local/bundle/gems/concurrent-ruby-1.3.5/lib/concurrent-ruby/concurrent/executor/ruby_thread_pool_executor.rb:341:in `loop'
/usr/local/bundle/gems/concurrent-ruby-1.3.5/lib/concurrent-ruby/concurrent/executor/ruby_thread_pool_executor.rb:341:in `block (2 levels) in create_worker'
/usr/local/bundle/gems/concurrent-ruby-1.3.5/lib/concurrent-ruby/concurrent/executor/ruby_thread_pool_executor.rb:340:in `catch'
/usr/local/bundle/gems/concurrent-ruby-1.3.5/lib/concurrent-ruby/concurrent/executor/ruby_thread_pool_executor.rb:340:in `block in create_worker'

with Raw data where we indeed see the wrong locale, but where it comes from..

{
  "id": 82994,
  "queue_name": "solid_queue_recurring",
  "class_name": "SolidQueue::RecurringJob",
  "arguments": {
    "job_class": "SolidQueue::RecurringJob",
    "job_id": "a09e58fd-83ad-4bd6-a4aa-be86715513f8",
    "provider_job_id": null,
    "queue_name": "solid_queue_recurring",
    "priority": null,
    "arguments": [
      "InstagramPostJob.perform_later if Rails.env.production?"
    ],
    "executions": 0,
    "exception_executions": {},
    "locale": "en",
    "timezone": "UTC",
    "enqueued_at": "2025-03-29T08:26:52.717299083Z",
    "scheduled_at": "2025-03-29T08:26:52.717269960Z"
  },
  "priority": 0,
  "active_job_id": "a09e58fd-83ad-4bd6-a4aa-be86715513f8",
  "scheduled_at": "2025-03-29T08:26:52.717Z",
  "finished_at": null,
  "concurrency_key": null,
  "created_at": "2025-03-29T08:26:52.717Z",
  "updated_at": "2025-03-29T08:26:52.717Z"
}

Versions:
solid_queue (1.1.4)
mission_control-jobs (1.0.2)
rails (7.2.2.1)
ruby 3.2.2p53

Please help :) I'm a bit lost on where it thinks is should be "locale": "en",..

@martijnenco
Copy link
Author

martijnenco commented Mar 29, 2025

Same thing happens when I add it as a class instead of a command

'DailyInstagramPost':
  class: InstagramPostJob
  schedule: "at 12pm every day"

InstagramPostJob.perform_later directly in the console works, so somewhere it goes wrong :/

@martijnenco
Copy link
Author

Hmm, i 'fixed' it with:

class MyRecurringCommandJob < ApplicationJob
  I18n.locale = I18n.default_locale

  def perform(command)
    eval(command) # rubocop:disable Security/Eval
  end
end

though I still think this is a bug that should looked into..

@rosa
Copy link
Member

rosa commented Mar 31, 2025

Hey @martijnenco, yeah, I'll look into it. I'm surprised this hasn't come up before, as I know many people using Solid Queue with not the default locales based on some fixes I had to do in Mission Control – Jobs. I'll try to figure out what it is.

@martijnenco
Copy link
Author

@rosa Thanks a bunch! I dont know if it's relevant but I also have issues inside mission control, there the locale is also forceset on 'en'. And most translations/date-locals are missing.

@rosa
Copy link
Member

rosa commented Mar 31, 2025

@martijnenco, Mission Control uses only en, so no translations are missing, there just aren't any translations available. It's isolated from the main app, though. What issues do you have there?

I've been looking into this but I don't know what's going on. The locale management in jobs is all done by Active Job. It uses the value set by I18n.locale when serializing the job, before passing it to the queue adapter. It seems the wrong value for I18n.locale is set somehow when the job is being enqueued in this case, or rather, not set at all, so it falls back to en as default. When you enqueue the job from the console, this is set, so it makes me think the problem is the Solid Queue scheduler no having a correctly configured locale. Could you let me know how you're starting Solid Queue, and whether you have other locale configuration outside your application.rb file?

@martijnenco
Copy link
Author

martijnenco commented Mar 31, 2025

@rosa It's already a huge consolation for me that you aren't able to figure it out aswell.

The mission control issue for me is this: (this is development, where raise_on_missing_translations = true)

I18n::MissingTranslationData in MissionControl::Jobs::Jobs#index
Showing /home/martijn/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/mission_control-jobs-1.0.2/app/views/mission_control/jobs/jobs/_job.html.erb where line #9 raised:

Translation missing: en.datetime.distance_in_words.x_days
Extracted source (around line #90):              
        I18n.exception_handler = ->(exception, *) {
          exception = exception.to_exception if exception.is_a?(I18n::MissingTranslation)
          raise exception
        }
      end
    end

This leads me to this: where locale is set set to :en and it tries to find en.datetime.distance_in_words https://github.com/rails/mission_control-jobs/blob/main/app/helpers/mission_control/jobs/dates_helper.rb#L16
Looks to be a different bug though, but with likely the same cause (:en not being a valid language in my application)

I did now figure out that at the moment the callstack the gem sentry-rails hits, the job.locale variable is already nil, and at a later point it wil try to default to :en indeed. So that aligns with what you're saying.

Anway, the app is deployed and started with the use of kamal (1.9.2) everything is inside 1 docker container, when the docker is ready rails is started with CMD ["./bin/rails", "server"] which starts the puma (6.6.0) web server. In my puma pretty much default config I added the line plugin :solid_queue. So now I indeed think this might be the problem? My puma knowledge is very limited..

No where in my application I define additional languages. I do have some gems that may (but unlikely) cause side-effects:

# I18n
gem 'currencies'
gem 'http_accept_language', '~> 2.1'
gem 'route_translator', '~> 14.1'
gem 'tzinfo-data', platforms: %i[mingw mswin x64_mingw jruby]

@rosa
Copy link
Member

rosa commented Mar 31, 2025

In my puma pretty much default config I added the line plugin :solid_queue. So now I indeed think this might be the problem?

In theory this should just work as well... I'm going to try to reproduce this with a very simple app.

@rosa
Copy link
Member

rosa commented Mar 31, 2025

Hey @martijnenco, I haven't managed to reproduce this 😕 I've created a brand new app with all defaults, and then made the following changes:

diff --git a/config/application.rb b/config/application.rb
index fc3289e..e43d7fc 100644
--- a/config/application.rb
+++ b/config/application.rb
@@ -23,5 +23,7 @@ class Application < Rails::Application
     #
     # config.time_zone = "Central Time (US & Canada)"
     # config.eager_load_paths << Rails.root.join("extras")
+    config.i18n.default_locale = "nl-NL"
+    config.i18n.available_locales = [ "nl-NL", "en-GB" ]

diff --git a/config/database.yml b/config/database.yml
index 2640cb5..e1e6f3a 100644
--- a/config/database.yml
+++ b/config/database.yml
@@ -10,8 +10,13 @@ default: &default
   timeout: 5000

 development:
-  <<: *default
-  database: storage/development.sqlite3
+  primary:
+    <<: *default
+    database: storage/development.sqlite3
+  queue:
+    <<: *default
+    database: storage/development_queue.sqlite3
+    migrations_paths: db/queue_migrate

 # Warning: The database defined as "test" will be erased and
 # re-generated from your development database when you run "rake".
diff --git a/config/environments/development.rb b/config/environments/development.rb
index 4cc21c4..089f6ff 100644
--- a/config/environments/development.rb
+++ b/config/environments/development.rb
@@ -69,4 +69,8 @@

   # Apply autocorrection by RuboCop to files generated by `bin/rails generate`.
   # config.generators.apply_rubocop_autocorrect_after_generate!
+
+  # Replace the default in-process and non-durable queuing backend for Active Job.
+  config.active_job.queue_adapter = :solid_queue
+  config.solid_queue.connects_to = { database: { writing: :queue } }

diff --git a/config/puma.rb b/config/puma.rb
index a248513..8f393c3 100644
--- a/config/puma.rb
+++ b/config/puma.rb
@@ -34,7 +34,7 @@
 plugin :tmp_restart

 # Run the Solid Queue supervisor inside of Puma for single-server deployments
-plugin :solid_queue if ENV["SOLID_QUEUE_IN_PUMA"]
+plugin :solid_queue

Then, I've added the following to recurring.yml:

test_locale_job:
  class: TestLocaleJob
  schedule: every second

And created this job:

class TestLocaleJob < ApplicationJob
  def perform
    Rails.logger.warn("Running TestLocaleJob with I18n.locale = #{I18n.locale}")
  end
end

Then, when starting Rails, everything works as expected:

SolidQueue-1.1.4 Enqueued recurring task (16.6ms)  task: "test_locale_job", active_job_id: "16fa07b5-bc3c-4a1b-a832-719969493ea8", at: "2025-03-31T17:23:43Z"
  SolidQueue::Job Load (0.0ms)  SELECT "solid_queue_jobs".* FROM "solid_queue_jobs" WHERE "solid_queue_jobs"."id" = 6 LIMIT 1 /*application='TestI18nSq'*/
[ActiveJob] [TestLocaleJob] [16fa07b5-bc3c-4a1b-a832-719969493ea8] Performing TestLocaleJob (Job ID: 16fa07b5-bc3c-4a1b-a832-719969493ea8) from SolidQueue(default) enqueued at 2025-03-31T17:23:43.012791000Z
[ActiveJob] [TestLocaleJob] [16fa07b5-bc3c-4a1b-a832-719969493ea8] Running TestLocaleJob with I18n.locale = nl-NL
[ActiveJob] [TestLocaleJob] [16fa07b5-bc3c-4a1b-a832-719969493ea8] Performed TestLocaleJob (Job ID: 16fa07b5-bc3c-4a1b-a832-719969493ea8) from SolidQueue(default) in 1.35ms
  TRANSACTION (0.0ms)  BEGIN immediate TRANSACTION /*application='TestI18nSq',job='TestLocaleJob'*/
  SolidQueue::Job Update (0.5ms)  UPDATE "solid_queue_jobs" SET "updated_at" = '2025-03-31 17:23:43.076154', "finished_at" = '2025-03-31 17:23:43.076154' WHERE "solid_queue_jobs"."id" = 6 /*application='TestI18nSq',job='TestLocaleJob'*/
  SolidQueue::ClaimedExecution Destroy (0.0ms)  DELETE FROM "solid_queue_claimed_executions" WHERE "solid_queue_claimed_executions"."id" = 6 /*application='TestI18nSq',job='TestLocaleJob'*/
  TRANSACTION (0.1ms)  COMMIT TRANSACTION /*application='TestI18nSq',job='TestLocaleJob'*/
[ActiveJob]   TRANSACTION (0.1ms)  BEGIN immediate TRANSACTION /*application='TestI18nSq'*/
[ActiveJob]   SolidQueue::Job Create (2.1ms)  INSERT INTO "solid_queue_jobs" ("queue_name", "class_name", "arguments", "priority", "active_job_id", "scheduled_at", "finished_at", "concurrency_key", "created_at", "updated_at") VALUES ('default', 'TestLocaleJob', '{"job_class":"TestLocaleJob","job_id":"afbb4513-da14-4f0a-a7a6-5192466286a9","provider_job_id":null,"queue_name":"default","priority":null,"arguments":[],"executions":0,"exception_executions":{},"locale":"nl-NL","timezone":"UTC","enqueued_at":"2025-03-31T17:23:44.016611000Z","scheduled_at":"2025-03-31T17:23:44.016567000Z"}', 0, 'afbb4513-da14-4f0a-a7a6-5192466286a9', '2025-03-31 17:23:44.016567', NULL, NULL, '2025-03-31 17:23:44.017228', '2025-03-31 17:23:44.017228') RETURNING "id" /*application='TestI18nSq'*/
[ActiveJob]   TRANSACTION (0.0ms)  SAVEPOINT active_record_1 /*application='TestI18nSq'*/
[ActiveJob]   SolidQueue::Job Load (1.4ms)  SELECT "solid_queue_jobs".* FROM "solid_queue_jobs" WHERE "solid_queue_jobs"."id" = 7 LIMIT 1 /*application='TestI18nSq'*/
[ActiveJob]   SolidQueue::ReadyExecution Create (0.1ms)  INSERT INTO "solid_queue_ready_executions" ("job_id", "queue_name", "priority", "created_at") VALUES (7, 'default', 0, '2025-03-31 17:23:44.030821') RETURNING "id" /*application='TestI18nSq'*/
[ActiveJob]   TRANSACTION (0.0ms)  RELEASE SAVEPOINT active_record_1 /*application='TestI18nSq'*/
[ActiveJob] Enqueued TestLocaleJob (Job ID: afbb4513-da14-4f0a-a7a6-5192466286a9) to SolidQueue(default)
  SolidQueue::RecurringExecution Insert (0.1ms)  INSERT INTO "solid_queue_recurring_executions" ("job_id","task_key","run_at","created_at") VALUES (7, 'test_locale_job', '2025-03-31 17:23:44', STRFTIME('%Y-%m-%d %H:%M:%f', 'NOW')) ON CONFLICT ("task_key","run_at") DO NOTHING RETURNING "id" /*application='TestI18nSq'*/
  TRANSACTION (0.2ms)  COMMIT TRANSACTION /*application='TestI18nSq'*/
SolidQueue-1.1.4 Enqueued recurring task (20.1ms)  task: "test_locale_job", active_job_id: "afbb4513-da14-4f0a-a7a6-5192466286a9", at: "2025-03-31T17:23:44Z"
  SolidQueue::Job Load (0.0ms)  SELECT "solid_queue_jobs".* FROM "solid_queue_jobs" WHERE "solid_queue_jobs"."id" = 7 LIMIT 1 /*application='TestI18nSq'*/
[ActiveJob] [TestLocaleJob] [afbb4513-da14-4f0a-a7a6-5192466286a9] Performing TestLocaleJob (Job ID: afbb4513-da14-4f0a-a7a6-5192466286a9) from SolidQueue(default) enqueued at 2025-03-31T17:23:44.016611000Z
[ActiveJob] [TestLocaleJob] [afbb4513-da14-4f0a-a7a6-5192466286a9] Running TestLocaleJob with I18n.locale = nl-NL
[ActiveJob] [TestLocaleJob] [afbb4513-da14-4f0a-a7a6-5192466286a9] Performed TestLocaleJob (Job ID: afbb4513-da14-4f0a-a7a6-5192466286a9) from SolidQueue(default) in 0.61ms
  TRANSACTION (0.0ms)  BEGIN immediate TRANSACTION /*application='TestI18nSq',job='TestLocaleJob'*/
  SolidQueue::Job Update (0.5ms)  UPDATE "solid_queue_jobs" SET "updated_at" = '2025-03-31 17:23:44.050375', "finished_at" = '2025-03-31 17:23:44.050375' WHERE "solid_queue_jobs"."id" = 7 /*application='TestI18nSq',job='TestLocaleJob'*/
  SolidQueue::ClaimedExecution Destroy (0.0ms)  DELETE FROM "solid_queue_claimed_executions" WHERE "solid_queue_claimed_executions"."id" = 7 /*application='TestI18nSq',job='TestLocaleJob'*/
  TRANSACTION (0.1ms)  COMMIT TRANSACTION /*application='TestI18nSq',job='TestLocaleJob'*/

Jobs are correctly enqueued with the default locale. From the rails console:

#<SolidQueue::Job:0x00000001223baf10
  id: 4,
  queue_name: "default",
  class_name: "TestLocaleJob",
  arguments:
   {"job_class" => "TestLocaleJob", "job_id" => "7e4c1779-c923-4e63-a9a4-3ef3c2b915c4", "provider_job_id" => nil, "queue_name" => "default", "priority" => nil, "arguments" => [], "executions" => 0, "exception_executions" => {}, "locale" => "nl-NL", "timezone" => "UTC", "enqueued_at" => "2025-03-31T17:23:41.019104000Z", "scheduled_at" => "2025-03-31T17:23:41.019064000Z"},
  priority: 0,
  active_job_id: "7e4c1779-c923-4e63-a9a4-3ef3c2b915c4",
  scheduled_at: "2025-03-31 17:23:41.019064000 +0000",
  finished_at: "2025-03-31 17:23:41.133301000 +0000",
  concurrency_key: nil,
  created_at: "2025-03-31 17:23:41.019632000 +0000",
  updated_at: "2025-03-31 17:23:41.133301000 +0000">,

@martijnenco
Copy link
Author

Hmm, let me try to reproduce this aswell..
I assume you used rails 8?

@rosa
Copy link
Member

rosa commented Mar 31, 2025

@martijnenco, yes, I used Rails 8. I saw you were using Rails 7.2, but I don't think the code involved has changed in a way that would make this break 🤔 I might be wrong, though!

@martijnenco
Copy link
Author

@rosa Hmmpf, I also can't reproduce it in a new app (running rails 7.2.2) :/ Really curious what it could be..

Anyway, if anyone has the same bug, this is a workaround:

Rails.application.config.after_initialize do # or to_prepare
  SolidQueue::RecurringTask.default_job_class = MyRecurringCommandJob
end

class MyRecurringCommandJob < ApplicationJob
  I18n.locale = I18n.default_locale

  def perform(command)
    eval(command) # rubocop:disable Security/Eval
  end
end

@martijnenco martijnenco closed this as not planned Won't fix, can't repro, duplicate, stale Apr 1, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants