从Rails 5.1.6升级到Rails 5.2.0以及422错误的响应页面后,我的生产服务器上针对所有POST请求都收到以下错误:
public class E : VisualCommanderExt.IExtension
{
public void SetSite(EnvDTE80.DTE2 DTE, Microsoft.VisualStudio.Shell.Package package)
{
this.DTE = DTE;
events = DTE.Events;
windowEvents = events.WindowEvents;
windowEvents.WindowActivated += OnWindowActivated;
documentEvents = events.DocumentEvents;
documentEvents.DocumentOpened += OnDocumentOpened;
}
public void Close()
{
windowEvents.WindowActivated -= OnWindowActivated;
documentEvents.DocumentOpened -= OnDocumentOpened;
}
private void OnDocumentOpened(EnvDTE.Document Document)
{
try
{
documentOpened = true;
}
catch (System.Exception)
{
}
}
private void OnWindowActivated(EnvDTE.Window gotFocus, EnvDTE.Window lostFocus)
{
try
{
if (documentOpened)
DTE.ExecuteCommand("Edit.CollapsetoDefinitions");
documentOpened = false;
}
catch (System.Exception)
{
}
}
private EnvDTE80.DTE2 DTE;
private EnvDTE.Events events;
private EnvDTE.WindowEvents windowEvents;
private EnvDTE.DocumentEvents documentEvents;
private bool documentOpened;
}
奇怪的是,即使服务器和本地都在Rails 5.2.0和Ruby 2.2.1上,在本地计算机上的生产模式下也没有出现这些错误。
在我的E, [2019-09-02T03:43:55.058585 #20734] ERROR -- : [c0b0b9f7-e94c-40d0-b01c-4b9b8e182df1] Couldn't find template for digesting: ands/and
E, [2019-09-02T03:43:56.576165 #20734] ERROR -- : [e50510ad-c88b-4d7a-95d2-7ff45ca7631a] Couldn't find template for digesting: ands/and
E, [2019-09-02T03:43:59.743162 #20734] ERROR -- : [14ec135d-728d-4d29-ba82-ee847b5cc5ac] Couldn't find template for digesting: ands/and
E, [2019-09-02T03:44:02.955968 #20734] ERROR -- : [439c3d51-b8e2-4e81-9593-41636a1a8b0e] Couldn't find template for digesting: ands/and
E, [2019-09-02T03:44:05.769064 #20734] ERROR -- : [e9a5f65e-a02d-4b3b-8679-a92cc58cc44d] Couldn't find template for digesting: ands/and
E, [2019-09-02T03:44:08.881931 #20734] ERROR -- : [4d3302d7-687d-41a6-b129-90c35a0e4f85] Couldn't find template for digesting: ands/and
E, [2019-09-02T03:44:12.096662 #20734] ERROR -- : [ee5732c9-4af0-41ae-8006-292a408b998f] Couldn't find template for digesting: ands/and
E, [2019-09-02T03:44:14.742001 #20734] ERROR -- : [d3d78895-aac8-4f36-8bc1-091bc119a3e0] Couldn't find template for digesting: ands/and
E, [2019-09-02T03:44:15.613034 #20734] ERROR -- : [6dc32662-8930-4b98-90d1-d89f32178bb8] Couldn't find template for digesting: ands/and
E, [2019-09-02T03:44:18.379969 #20734] ERROR -- : [480d9bc6-dc89-46c9-835c-b738eff33b6b] Couldn't find template for digesting: ands/and
E, [2019-09-02T03:44:21.304951 #20734] ERROR -- : [af5170c4-44e9-4358-bd41-06512ecb0523] Couldn't find template for digesting: ands/and
E, [2019-09-02T03:44:23.612308 #20734] ERROR -- : [a5da8930-9f93-4083-a77c-d8bdef91de7a] Couldn't find template for digesting: ands/and
E, [2019-09-02T03:44:24.208536 #20734] ERROR -- : [f3789639-1867-449b-b5bf-939d9f575c07] Couldn't find template for digesting: ands/and
E, [2019-09-02T03:44:27.119443 #20734] ERROR -- : [8d2b1581-d359-411a-b0c5-5975bbf5dc49] Couldn't find template for digesting: ands/and
E, [2019-09-02T03:44:30.304959 #20734] ERROR -- : [850b0e89-19df-465f-afa1-712e3db0e9ca] Couldn't find template for digesting: ands/and
上曾经有一个application_controller
方法,它带有::exception子句,像这样:
protect_from_forgery
…但是我将其移至class ApplicationController < ActionController::Base
before_action :authorize_mini_profiler
require 'sass/rails'
protect_from_forgery with: :exception
没有异常子句的回调之前:
before_action
现在我没有收到422错误的响应页面,但是日志中仍然包含class ApplicationController < ActionController::Base
protect_from_forgery
before_action :authorize_mini_profiler
require 'sass/rails'
错误,用户无法登录其帐户。
这个错误是如此神秘,在哪里看?