gpt4 book ai didi

ruby-on-rails - TypeError(没有将 nil 隐式转换为 String),仅在生产中

转载 作者:行者123 更新时间:2023-12-03 16:50:46 26 4
gpt4 key购买 nike

我有一个使用 nginx 在 Ubuntu 上运行的 Rails 应用程序。似乎我在任何涉及 ActiveRecord 的页面上都收到了 TypeError (no implicit conversion of nil into String)

这是给出错误的行的示例:

@instance = Instance.new

此错误不会在本地发生。

我可以毫无问题地打开生产控制台并实例化和保存记录。

导致此错误的原因可能是什么?

编辑 :这似乎只发生在与 Active-Record 相关的行中。如果我做例如 @foo = 'bar' ,不会引发异常。

编辑 2 :这是完整的回溯:
I, [2019-08-27T17:44:48.170158 #28979]  INFO -- : [dbaa09fa-9bbf-4e85-8c3f-3a43992c2fa2] Started GET "/instances/new" for 75.129.211.194 at 2019-08-27 17:44:48 +0000                        
I, [2019-08-27T17:44:48.172925 #28979] INFO -- : [dbaa09fa-9bbf-4e85-8c3f-3a43992c2fa2] Processing by InstancesController#new as HTML
D, [2019-08-27T17:44:48.179086 #28979] DEBUG -- : [dbaa09fa-9bbf-4e85-8c3f-3a43992c2fa2] /home/ubuntu/.rvm/gems/ruby-2.6.3/gems/activerecord-6.0.0/lib/active_record/connection_adapters/postgresql_adapter.rb:49:in `include?'
D, [2019-08-27T17:44:48.179212 #28979] DEBUG -- : [dbaa09fa-9bbf-4e85-8c3f-3a43992c2fa2] /home/ubuntu/.rvm/gems/ruby-2.6.3/gems/activerecord-6.0.0/lib/active_record/connection_adapters/postgresql_adapter.rb:49:in `rescue in postgresql_connection'
D, [2019-08-27T17:44:48.179326 #28979] DEBUG -- : [dbaa09fa-9bbf-4e85-8c3f-3a43992c2fa2] /home/ubuntu/.rvm/gems/ruby-2.6.3/gems/activerecord-6.0.0/lib/active_record/connection_adapters/post
gresql_adapter.rb:33:in `postgresql_connection'
D, [2019-08-27T17:44:48.179441 #28979] DEBUG -- : [dbaa09fa-9bbf-4e85-8c3f-3a43992c2fa2] /home/ubuntu/.rvm/gems/ruby-2.6.3/gems/activerecord-6.0.0/lib/active_record/connection_adapters/abstract/connection_pool.rb:879:in `new_connection'
D, [2019-08-27T17:44:48.179565 #28979] DEBUG -- : [dbaa09fa-9bbf-4e85-8c3f-3a43992c2fa2] /home/ubuntu/.rvm/gems/ruby-2.6.3/gems/activerecord-6.0.0/lib/active_record/connection_adapters/abstract/connection_pool.rb:923:in `checkout_new_connection'
D, [2019-08-27T17:44:48.179676 #28979] DEBUG -- : [dbaa09fa-9bbf-4e85-8c3f-3a43992c2fa2] /home/ubuntu/.rvm/gems/ruby-2.6.3/gems/activerecord-6.0.0/lib/active_record/connection_adapters/abst
ract/connection_pool.rb:902:in `try_to_checkout_new_connection' D, [2019-08-27T17:44:48.179793 #28979] DEBUG -- : [dbaa09fa-9bbf-4e85-8c3f-3a43992c2fa2] /home/ubuntu/.rvm/gems/ruby-2.6.3/gems/activerecord-6.0.0/lib/active_record/connection_adapters/abst
ract/connection_pool.rb:863:in `acquire_connection'
D, [2019-08-27T17:44:48.179905 #28979] DEBUG -- : [dbaa09fa-9bbf-4e85-8c3f-3a43992c2fa2] /home/ubuntu/.rvm/gems/ruby-2.6.3/gems/activerecord-6.0.0/lib/active_record/connection_adapters/abst
ract/connection_pool.rb:587:in `checkout' D, [2019-08-27T17:44:48.180005 #28979] DEBUG -- : [dbaa09fa-9bbf-4e85-8c3f-3a43992c2fa2] /home/ubuntu/.rvm/gems/ruby-2.6.3/gems/activerecord-6.0.0/lib/active_record/connection_adapters/abst
ract/connection_pool.rb:431:in `connection'
D, [2019-08-27T17:44:48.180098 #28979] DEBUG -- : [dbaa09fa-9bbf-4e85-8c3f-3a43992c2fa2] /home/ubuntu/.rvm/gems/ruby-2.6.3/gems/activerecord-6.0.0/lib/active_record/connection_adapters/abstract/connection_pool.rb:1111:in `retrieve_connection'
D, [2019-08-27T17:44:48.180189 #28979] DEBUG -- : [dbaa09fa-9bbf-4e85-8c3f-3a43992c2fa2] /home/ubuntu/.rvm/gems/ruby-2.6.3/gems/activerecord-6.0.0/lib/active_record/connection_handling.rb:231:in `retrieve_connection'
D, [2019-08-27T17:44:48.180273 #28979] DEBUG -- : [dbaa09fa-9bbf-4e85-8c3f-3a43992c2fa2] /home/ubuntu/.rvm/gems/ruby-2.6.3/gems/activerecord-6.0.0/lib/active_record/connection_handling.rb:1
99:in `connection'
D, [2019-08-27T17:44:48.180353 #28979] DEBUG -- : [dbaa09fa-9bbf-4e85-8c3f-3a43992c2fa2] /home/ubuntu/.rvm/gems/ruby-2.6.3/gems/activerecord-6.0.0/lib/active_record/model_schema.rb:487:in `
load_schema!'
D, [2019-08-27T17:44:48.180431 #28979] DEBUG -- : [dbaa09fa-9bbf-4e85-8c3f-3a43992c2fa2] /home/ubuntu/.rvm/gems/ruby-2.6.3/gems/activerecord-6.0.0/lib/active_record/attributes.rb:247:in `lo
ad_schema!'
D, [2019-08-27T17:44:48.180523 #28979] DEBUG -- : [dbaa09fa-9bbf-4e85-8c3f-3a43992c2fa2] /home/ubuntu/.rvm/gems/ruby-2.6.3/gems/activerecord-6.0.0/lib/active_record/attribute_decorators.rb:
51:in `load_schema!'
D, [2019-08-27T17:44:48.180604 #28979] DEBUG -- : [dbaa09fa-9bbf-4e85-8c3f-3a43992c2fa2] /home/ubuntu/.rvm/gems/ruby-2.6.3/gems/activerecord-6.0.0/lib/active_record/model_schema.rb:480:in `
block in load_schema'
D, [2019-08-27T17:44:48.180685 #28979] DEBUG -- : [dbaa09fa-9bbf-4e85-8c3f-3a43992c2fa2] /home/ubuntu/.rvm/rubies/ruby-2.6.3/lib/ruby/2.6.0/monitor.rb:230:in `mon_synchronize'
D, [2019-08-27T17:44:48.180782 #28979] DEBUG -- : [dbaa09fa-9bbf-4e85-8c3f-3a43992c2fa2] /home/ubuntu/.rvm/gems/ruby-2.6.3/gems/activerecord-6.0.0/lib/active_record/model_schema.rb:477:in `
load_schema'
D, [2019-08-27T17:44:48.180887 #28979] DEBUG -- : [dbaa09fa-9bbf-4e85-8c3f-3a43992c2fa2] /home/ubuntu/.rvm/gems/ruby-2.6.3/gems/activerecord-6.0.0/lib/active_record/model_schema.rb:362:in `
attribute_types'
D, [2019-08-27T17:44:48.180962 #28979] DEBUG -- : [dbaa09fa-9bbf-4e85-8c3f-3a43992c2fa2] /home/ubuntu/.rvm/gems/ruby-2.6.3/gems/activerecord-6.0.0/lib/active_record/attribute_methods.rb:171
:in `has_attribute?'
D, [2019-08-27T17:44:48.181045 #28979] DEBUG -- : [dbaa09fa-9bbf-4e85-8c3f-3a43992c2fa2] /home/ubuntu/.rvm/gems/ruby-2.6.3/gems/activerecord-6.0.0/lib/active_record/inheritance.rb:55:in `ne
w'
D, [2019-08-27T17:44:48.181143 #28979] DEBUG -- : [dbaa09fa-9bbf-4e85-8c3f-3a43992c2fa2] /var/www/mothership/app/controllers/instances_controller.rb:16:in `new' [69/1859]
D, [2019-08-27T17:44:48.181223 #28979] DEBUG -- : [dbaa09fa-9bbf-4e85-8c3f-3a43992c2fa2] /home/ubuntu/.rvm/gems/ruby-2.6.3/gems/actionpack-6.0.0/lib/action_controller/metal/basic_implicit_r
ender.rb:6:in `send_action'
D, [2019-08-27T17:44:48.181305 #28979] DEBUG -- : [dbaa09fa-9bbf-4e85-8c3f-3a43992c2fa2] /home/ubuntu/.rvm/gems/ruby-2.6.3/gems/actionpack-6.0.0/lib/abstract_controller/base.rb:196:in `proc
ess_action'
D, [2019-08-27T17:44:48.181386 #28979] DEBUG -- : [dbaa09fa-9bbf-4e85-8c3f-3a43992c2fa2] /home/ubuntu/.rvm/gems/ruby-2.6.3/gems/actionpack-6.0.0/lib/action_controller/metal/rendering.rb:30:
in `process_action'
D, [2019-08-27T17:44:48.181464 #28979] DEBUG -- : [dbaa09fa-9bbf-4e85-8c3f-3a43992c2fa2] /home/ubuntu/.rvm/gems/ruby-2.6.3/gems/actionpack-6.0.0/lib/abstract_controller/callbacks.rb:42:in `
block in process_action'
D, [2019-08-27T17:44:48.181548 #28979] DEBUG -- : [dbaa09fa-9bbf-4e85-8c3f-3a43992c2fa2] /home/ubuntu/.rvm/gems/ruby-2.6.3/gems/activesupport-6.0.0/lib/active_support/callbacks.rb:135:in `r
un_callbacks'
D, [2019-08-27T17:44:48.181624 #28979] DEBUG -- : [dbaa09fa-9bbf-4e85-8c3f-3a43992c2fa2] /home/ubuntu/.rvm/gems/ruby-2.6.3/gems/actionpack-6.0.0/lib/abstract_controller/callbacks.rb:41:in `
process_action'
D, [2019-08-27T17:44:48.181705 #28979] DEBUG -- : [dbaa09fa-9bbf-4e85-8c3f-3a43992c2fa2] /home/ubuntu/.rvm/gems/ruby-2.6.3/gems/actionpack-6.0.0/lib/action_controller/metal/rescue.rb:22:in
`process_action'
D, [2019-08-27T17:44:48.181791 #28979] DEBUG -- : [dbaa09fa-9bbf-4e85-8c3f-3a43992c2fa2] /home/ubuntu/.rvm/gems/ruby-2.6.3/gems/actionpack-6.0.0/lib/action_controller/metal/instrumentation.
rb:33:in `block in process_action'
D, [2019-08-27T17:44:48.181871 #28979] DEBUG -- : [dbaa09fa-9bbf-4e85-8c3f-3a43992c2fa2] /home/ubuntu/.rvm/gems/ruby-2.6.3/gems/activesupport-6.0.0/lib/active_support/notifications.rb:180:i
n `block in instrument'
D, [2019-08-27T17:44:48.181954 #28979] DEBUG -- : [dbaa09fa-9bbf-4e85-8c3f-3a43992c2fa2] /home/ubuntu/.rvm/gems/ruby-2.6.3/gems/activesupport-6.0.0/lib/active_support/notifications/instrume
nter.rb:24:in `instrument'
D, [2019-08-27T17:44:48.182034 #28979] DEBUG -- : [dbaa09fa-9bbf-4e85-8c3f-3a43992c2fa2] /home/ubuntu/.rvm/gems/ruby-2.6.3/gems/activesupport-6.0.0/lib/active_support/notifications.rb:180:i
n `instrument'
D, [2019-08-27T17:44:48.182109 #28979] DEBUG -- : [dbaa09fa-9bbf-4e85-8c3f-3a43992c2fa2] /home/ubuntu/.rvm/gems/ruby-2.6.3/gems/actionpack-6.0.0/lib/action_controller/metal/instrumentation.
rb:32:in `process_action'
D, [2019-08-27T17:44:48.182193 #28979] DEBUG -- : [dbaa09fa-9bbf-4e85-8c3f-3a43992c2fa2] /home/ubuntu/.rvm/gems/ruby-2.6.3/gems/actionpack-6.0.0/lib/action_controller/metal/params_wrapper.r
b:245:in `process_action'
D, [2019-08-27T17:44:48.182280 #28979] DEBUG -- : [dbaa09fa-9bbf-4e85-8c3f-3a43992c2fa2] /home/ubuntu/.rvm/gems/ruby-2.6.3/gems/activerecord-6.0.0/lib/active_record/railties/controller_runt
ime.rb:27:in `process_action'
D, [2019-08-27T17:44:48.182368 #28979] DEBUG -- : [dbaa09fa-9bbf-4e85-8c3f-3a43992c2fa2] /home/ubuntu/.rvm/gems/ruby-2.6.3/gems/actionpack-6.0.0/lib/abstract_controller/base.rb:136:in `proc
ess'
D, [2019-08-27T17:44:48.182440 #28979] DEBUG -- : [dbaa09fa-9bbf-4e85-8c3f-3a43992c2fa2] /home/ubuntu/.rvm/gems/ruby-2.6.3/gems/actionview-6.0.0/lib/action_view/rendering.rb:39:in `process'
D, [2019-08-27T17:44:48.182530 #28979] DEBUG -- : [dbaa09fa-9bbf-4e85-8c3f-3a43992c2fa2] /home/ubuntu/.rvm/gems/ruby-2.6.3/gems/actionpack-6.0.0/lib/action_controller/metal.rb:191:in `dispa
tch'
D, [2019-08-27T17:44:48.182604 #28979] DEBUG -- : [dbaa09fa-9bbf-4e85-8c3f-3a43992c2fa2] /home/ubuntu/.rvm/gems/ruby-2.6.3/gems/actionpack-6.0.0/lib/action_controller/metal.rb:252:in `dispa
tch'
D, [2019-08-27T17:44:48.182678 #28979] DEBUG -- : [dbaa09fa-9bbf-4e85-8c3f-3a43992c2fa2] /home/ubuntu/.rvm/gems/ruby-2.6.3/gems/actionpack-6.0.0/lib/action_dispatch/routing/route_set.rb:51:
in `dispatch'
D, [2019-08-27T17:44:48.182759 #28979] DEBUG -- : [dbaa09fa-9bbf-4e85-8c3f-3a43992c2fa2] /home/ubuntu/.rvm/gems/ruby-2.6.3/gems/actionpack-6.0.0/lib/action_dispatch/routing/route_set.rb:33:
in `serve'
D, [2019-08-27T17:44:48.182875 #28979] DEBUG -- : [dbaa09fa-9bbf-4e85-8c3f-3a43992c2fa2] /home/ubuntu/.rvm/gems/ruby-2.6.3/gems/actionpack-6.0.0/lib/action_dispatch/journey/router.rb:49:in
`block in serve'
D, [2019-08-27T17:44:48.182949 #28979] DEBUG -- : [dbaa09fa-9bbf-4e85-8c3f-3a43992c2fa2] /home/ubuntu/.rvm/gems/ruby-2.6.3/gems/actionpack-6.0.0/lib/action_dispatch/journey/router.rb:32:in
`each'
D, [2019-08-27T17:44:48.183027 #28979] DEBUG -- : [dbaa09fa-9bbf-4e85-8c3f-3a43992c2fa2] /home/ubuntu/.rvm/gems/ruby-2.6.3/gems/actionpack-6.0.0/lib/action_dispatch/journey/router.rb:32:in
`serve'
D, [2019-08-27T17:44:48.183101 #28979] DEBUG -- : [dbaa09fa-9bbf-4e85-8c3f-3a43992c2fa2] /home/ubuntu/.rvm/gems/ruby-2.6.3/gems/actionpack-6.0.0/lib/action_dispatch/routing/route_set.rb:837
:in `call'
D, [2019-08-27T17:44:48.183182 #28979] DEBUG -- : [dbaa09fa-9bbf-4e85-8c3f-3a43992c2fa2] /home/ubuntu/.rvm/gems/ruby-2.6.3/gems/rack-2.0.7/lib/rack/tempfile_reaper.rb:15:in `call' [21/1859]
D, [2019-08-27T17:44:48.183279 #28979] DEBUG -- : [dbaa09fa-9bbf-4e85-8c3f-3a43992c2fa2] /home/ubuntu/.rvm/gems/ruby-2.6.3/gems/rack-2.0.7/lib/rack/etag.rb:25:in `call'
D, [2019-08-27T17:44:48.183358 #28979] DEBUG -- : [dbaa09fa-9bbf-4e85-8c3f-3a43992c2fa2] /home/ubuntu/.rvm/gems/ruby-2.6.3/gems/rack-2.0.7/lib/rack/conditional_get.rb:25:in `call'
D, [2019-08-27T17:44:48.183439 #28979] DEBUG -- : [dbaa09fa-9bbf-4e85-8c3f-3a43992c2fa2] /home/ubuntu/.rvm/gems/ruby-2.6.3/gems/rack-2.0.7/lib/rack/head.rb:12:in `call'
D, [2019-08-27T17:44:48.183517 #28979] DEBUG -- : [dbaa09fa-9bbf-4e85-8c3f-3a43992c2fa2] /home/ubuntu/.rvm/gems/ruby-2.6.3/gems/actionpack-6.0.0/lib/action_dispatch/http/content_security_po
licy.rb:18:in `call'
D, [2019-08-27T17:44:48.183597 #28979] DEBUG -- : [dbaa09fa-9bbf-4e85-8c3f-3a43992c2fa2] /home/ubuntu/.rvm/gems/ruby-2.6.3/gems/rack-2.0.7/lib/rack/session/abstract/id.rb:232:in `context'
D, [2019-08-27T17:44:48.183677 #28979] DEBUG -- : [dbaa09fa-9bbf-4e85-8c3f-3a43992c2fa2] /home/ubuntu/.rvm/gems/ruby-2.6.3/gems/rack-2.0.7/lib/rack/session/abstract/id.rb:226:in `call'
D, [2019-08-27T17:44:48.183757 #28979] DEBUG -- : [dbaa09fa-9bbf-4e85-8c3f-3a43992c2fa2] /home/ubuntu/.rvm/gems/ruby-2.6.3/gems/actionpack-6.0.0/lib/action_dispatch/middleware/cookies.rb:64
8:in `call'
D, [2019-08-27T17:44:48.183848 #28979] DEBUG -- : [dbaa09fa-9bbf-4e85-8c3f-3a43992c2fa2] /home/ubuntu/.rvm/gems/ruby-2.6.3/gems/actionpack-6.0.0/lib/action_dispatch/middleware/callbacks.rb:
27:in `block in call'
D, [2019-08-27T17:44:48.183921 #28979] DEBUG -- : [dbaa09fa-9bbf-4e85-8c3f-3a43992c2fa2] /home/ubuntu/.rvm/gems/ruby-2.6.3/gems/activesupport-6.0.0/lib/active_support/callbacks.rb:101:in `r
un_callbacks'
D, [2019-08-27T17:44:48.184013 #28979] DEBUG -- : [dbaa09fa-9bbf-4e85-8c3f-3a43992c2fa2] /home/ubuntu/.rvm/gems/ruby-2.6.3/gems/actionpack-6.0.0/lib/action_dispatch/middleware/callbacks.rb:
26:in `call'
D, [2019-08-27T17:44:48.184087 #28979] DEBUG -- : [dbaa09fa-9bbf-4e85-8c3f-3a43992c2fa2] /home/ubuntu/.rvm/gems/ruby-2.6.3/gems/actionpack-6.0.0/lib/action_dispatch/middleware/actionable_ex
ceptions.rb:17:in `call'
D, [2019-08-27T17:44:48.184162 #28979] DEBUG -- : [dbaa09fa-9bbf-4e85-8c3f-3a43992c2fa2] /home/ubuntu/.rvm/gems/ruby-2.6.3/gems/actionpack-6.0.0/lib/action_dispatch/middleware/debug_excepti
ons.rb:32:in `call'
D, [2019-08-27T17:44:48.184246 #28979] DEBUG -- : [dbaa09fa-9bbf-4e85-8c3f-3a43992c2fa2] /home/ubuntu/.rvm/gems/ruby-2.6.3/gems/actionpack-6.0.0/lib/action_dispatch/middleware/show_exceptio
ns.rb:33:in `call'
D, [2019-08-27T17:44:48.184328 #28979] DEBUG -- : [dbaa09fa-9bbf-4e85-8c3f-3a43992c2fa2] /home/ubuntu/.rvm/gems/ruby-2.6.3/gems/railties-6.0.0/lib/rails/rack/logger.rb:38:in `call_app'
D, [2019-08-27T17:44:48.184412 #28979] DEBUG -- : [dbaa09fa-9bbf-4e85-8c3f-3a43992c2fa2] /home/ubuntu/.rvm/gems/ruby-2.6.3/gems/railties-6.0.0/lib/rails/rack/logger.rb:26:in `block in call'
D, [2019-08-27T17:44:48.184487 #28979] DEBUG -- : [dbaa09fa-9bbf-4e85-8c3f-3a43992c2fa2] /home/ubuntu/.rvm/gems/ruby-2.6.3/gems/activesupport-6.0.0/lib/active_support/tagged_logging.rb:80:i
n `block in tagged'
D, [2019-08-27T17:44:48.184567 #28979] DEBUG -- : [dbaa09fa-9bbf-4e85-8c3f-3a43992c2fa2] /home/ubuntu/.rvm/gems/ruby-2.6.3/gems/activesupport-6.0.0/lib/active_support/tagged_logging.rb:28:i
n `tagged'
D, [2019-08-27T17:44:48.184642 #28979] DEBUG -- : [dbaa09fa-9bbf-4e85-8c3f-3a43992c2fa2] /home/ubuntu/.rvm/gems/ruby-2.6.3/gems/activesupport-6.0.0/lib/active_support/tagged_logging.rb:80:i
n `tagged'
D, [2019-08-27T17:44:48.184716 #28979] DEBUG -- : [dbaa09fa-9bbf-4e85-8c3f-3a43992c2fa2] /home/ubuntu/.rvm/gems/ruby-2.6.3/gems/railties-6.0.0/lib/rails/rack/logger.rb:26:in `call'
D, [2019-08-27T17:44:48.184797 #28979] DEBUG -- : [dbaa09fa-9bbf-4e85-8c3f-3a43992c2fa2] /home/ubuntu/.rvm/gems/ruby-2.6.3/gems/actionpack-6.0.0/lib/action_dispatch/middleware/remote_ip.rb:
81:in `call'
D, [2019-08-27T17:44:48.184884 #28979] DEBUG -- : [dbaa09fa-9bbf-4e85-8c3f-3a43992c2fa2] /home/ubuntu/.rvm/gems/ruby-2.6.3/gems/actionpack-6.0.0/lib/action_dispatch/middleware/request_id.rb
:27:in `call'
D, [2019-08-27T17:44:48.184964 #28979] DEBUG -- : [dbaa09fa-9bbf-4e85-8c3f-3a43992c2fa2] /home/ubuntu/.rvm/gems/ruby-2.6.3/gems/rack-2.0.7/lib/rack/method_override.rb:22:in `call'
D, [2019-08-27T17:44:48.185058 #28979] DEBUG -- : [dbaa09fa-9bbf-4e85-8c3f-3a43992c2fa2] /home/ubuntu/.rvm/gems/ruby-2.6.3/gems/rack-2.0.7/lib/rack/runtime.rb:22:in `call'
D, [2019-08-27T17:44:48.185130 #28979] DEBUG -- : [dbaa09fa-9bbf-4e85-8c3f-3a43992c2fa2] /home/ubuntu/.rvm/gems/ruby-2.6.3/gems/activesupport-6.0.0/lib/active_support/cache/strategy/local_c
ache_middleware.rb:29:in `call'
D, [2019-08-27T17:44:48.185211 #28979] DEBUG -- : [dbaa09fa-9bbf-4e85-8c3f-3a43992c2fa2] /home/ubuntu/.rvm/gems/ruby-2.6.3/gems/actionpack-6.0.0/lib/action_dispatch/middleware/executor.rb:1
4:in `call'
D, [2019-08-27T17:44:48.185312 #28979] DEBUG -- : [dbaa09fa-9bbf-4e85-8c3f-3a43992c2fa2] /home/ubuntu/.rvm/gems/ruby-2.6.3/gems/rack-2.0.7/lib/rack/sendfile.rb:111:in `call'
D, [2019-08-27T17:44:48.185386 #28979] DEBUG -- : [dbaa09fa-9bbf-4e85-8c3f-3a43992c2fa2] /home/ubuntu/.rvm/gems/ruby-2.6.3/gems/actionpack-6.0.0/lib/action_dispatch/middleware/host_authoriz
ation.rb:77:in `call'
D, [2019-08-27T17:44:48.185466 #28979] DEBUG -- : [dbaa09fa-9bbf-4e85-8c3f-3a43992c2fa2] /home/ubuntu/.rvm/gems/ruby-2.6.3/gems/railties-6.0.0/lib/rails/engine.rb:526:in `call'
D, [2019-08-27T17:44:48.185545 #28979] DEBUG -- : [dbaa09fa-9bbf-4e85-8c3f-3a43992c2fa2] /usr/lib/ruby/vendor_ruby/phusion_passenger/rack/thread_handler_extension.rb:97:in `process_request'
D, [2019-08-27T17:44:48.185620 #28979] DEBUG -- : [dbaa09fa-9bbf-4e85-8c3f-3a43992c2fa2] /usr/lib/ruby/vendor_ruby/phusion_passenger/request_handler/thread_handler.rb:149:in `accept_and_pro
cess_next_request'
D, [2019-08-27T17:44:48.185699 #28979] DEBUG -- : [dbaa09fa-9bbf-4e85-8c3f-3a43992c2fa2] /usr/lib/ruby/vendor_ruby/phusion_passenger/request_handler/thread_handler.rb:110:in `main_loop'
D, [2019-08-27T17:44:48.185784 #28979] DEBUG -- : [dbaa09fa-9bbf-4e85-8c3f-3a43992c2fa2] /usr/lib/ruby/vendor_ruby/phusion_passenger/request_handler.rb:415:in `block (3 levels) in start_thr
eads'
D, [2019-08-27T17:44:48.185871 #28979] DEBUG -- : [dbaa09fa-9bbf-4e85-8c3f-3a43992c2fa2] /usr/lib/ruby/vendor_ruby/phusion_passenger/utils.rb:113:in `block in create_thread_and_abort_on_exc
eption'
I, [2019-08-27T17:44:48.188284 #28979] INFO -- : [dbaa09fa-9bbf-4e85-8c3f-3a43992c2fa2] Rendering instances/new.html.erb within layouts/application
I, [2019-08-27T17:44:48.190953 #28979] INFO -- : [dbaa09fa-9bbf-4e85-8c3f-3a43992c2fa2] Rendered instances/_form.html.erb (Duration: 1.7ms | Allocations: 856)
I, [2019-08-27T17:44:48.191108 #28979] INFO -- : [dbaa09fa-9bbf-4e85-8c3f-3a43992c2fa2] Rendered instances/new.html.erb within layouts/application (Duration: 2.7ms | Allocations: 1197)
I, [2019-08-27T17:44:48.191352 #28979] INFO -- : [dbaa09fa-9bbf-4e85-8c3f-3a43992c2fa2] Completed 500 Internal Server Error in 18ms (Allocations: 3772)

最佳答案

根据给定的信息,我无法确定,但您的堆栈跟踪表明问题是您的 Postgres 连接的空配置参数,特别是 libpq .查看环境参数列表here .如果您的 shell 环境变量设置与应用程序不同,这将解释为什么您可以在生产中打开控制台而不会出现问题,并在应用程序不能时实例化和保存记录。

作为调试步骤,让您的应用程序将其所有环境变量转储到日志文件中,并确保在环境或 production 中设置了所有必需的数据库参数。 database.yml的部分

关于ruby-on-rails - TypeError(没有将 nil 隐式转换为 String),仅在生产中,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57617406/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com