javan / javan/whenever

Rails 6.1 no longer listens to -e param for runner

Open
#810 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Ruby
Stars
8.9k
Forks
715
PR merge metrics
No merged PRs in 30d

Description

The readme specifies that the default definition of "runner" is

job_type :runner,  "cd :path && bin/rails runner -e :environment ':task' :output"

It seems that Rails 6.1 (possibly Rails 6?) no longer supports defining the environment with the -e pram. As a result the runner would execute in the development environtment which caused a bunch of errors on production obviously. To fix, I needed to append "RAILS_ENV=production" to the bundle command in schedule.rb.

set :bundle_command, "RAILS_ENV=#{ENV["RAILS_ENV"]} bundle exec"

This fixed the issue but wondering if anyone else is seeing this issue and whether something needs to be fixed in the gem itself.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the README's default runner definition and the schedule.rb bundle_command workaround. Reproduce the Rails 6.1 behavior to check whether the -e environment is still passed through, then verify that runner jobs use the intended environment without requiring the workaround.

Written by the indexing model from the issue text.

Assessment

Tech stack
rails, ruby
Domain
cli
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.