Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Undefined method [] for nil when trying to run cap deploy:restart

Tags:

capistrano

I have a Rails 5.2 app, and with cap 3.4.1 we are suddenly getting this weird error:

    [b35efe76]  Phusion Passenger(R) 6.0.8
     DEBUG [b35efe76] Finished in 0.305 seconds with exit status 0 (successful).
    (Backtrace restricted to imported tasks)
    cap aborted!
    SSHKit::Runner::ExecuteError: Exception while executing as [email protected]: undefined method `[]' for nil:NilClass

Trying to narrow it down, it happens when attempting to restart, because this is the line that fails:

cap production deploy:restart

The question is, how do I go about finding what file is trying to call [] on a nil value on? Running cap with --trace is of no value because it just gives me internal errors - nothing in my code. Basically, how do I find out what is nil?

One more clue, currently, I have a bunch of servers, if I run the cap restart command on server A, it restarts fine, on server B, it throws this error, so I'm guessing there's an environment variable on server A but not B, but the error is just so opaque I don't know where to begin.

Thanks for any help, kevin

like image 476
user1130176 Avatar asked Apr 07 '21 03:04

user1130176


1 Answers

A wild guess: I had a similar problem and I could solve it by upgrading capistrano-passenger to >= 0.2.1

Looks like the version change of passenger from 6.0.7 to 6.0.8 has introduces a problem. I see you are also on 6.0.8, so it might affect you, too!

Link to the capistrano-passenger issue

like image 96
juffel Avatar answered Oct 06 '22 07:10

juffel