尝试 运行 cap deploy:restart 时未定义方法 [] 为 nil

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

我有一个 Rails 5.2 应用程序,使用 cap 3.4.1 时我们突然收到这个奇怪的错误:

    [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 deploy@host.com: undefined method `[]' for nil:NilClass

试图缩小它,它发生在试图重新启动时,因为这是失败的行:

cap production deploy:restart

问题是,我如何才能找到试图调用 [] 上的 nil 值的文件? 运行 cap with --trace 没有任何价值,因为它只会给我内部错误 - 我的代码中没有任何内容。基本上,我如何找出什么是 nil?

还有一个线索,目前,我有一堆服务器,如果我 运行 服务器 A 上的 cap restart 命令,它重启正常,在服务器 B 上,它抛出这个错误,所以我是猜测服务器 A 上有一个环境变量,但服务器 B 上没有,但错误是如此不透明,我不知道从哪里开始。

感谢您的帮助, 凯文

一个大胆的猜测:我有一个类似的问题,我可以通过将 capistrano-passenger 升级到 >= 0.2.1

来解决它

Looks likepassenger从6.0.7到6.0.8的版本变更引入了一个问题。我看你也是6.0.8,所以可能也会影响到你!

Link to the capistrano-passenger issue