whenever icon indicating copy to clipboard operation
whenever copied to clipboard

Rails 6.1 no longer listens to -e param for runner

Open ishields opened this issue 5 years ago • 2 comments

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.

ishields avatar Jan 11 '21 16:01 ishields

I just hit this issue in Rails 6.1. Thanks for the workaround. I think this is a valid bug report.

atomgiant avatar Jan 11 '21 19:01 atomgiant

Rails documentation (https://guides.rubyonrails.org/command_line.html#bin-rails-runner) says -e is still valid, and it worked locally for me. Good to know, so I'll keep an eye out for it on production.

timirwin avatar Feb 25 '21 20:02 timirwin