![](/img/trans.png)
[英]Elixir getting error from controller: Expected action/2 to return a Plug.Conn
[英]expected :action/2 to return a Plug.Conn error in Phoenix controller
我試圖讓Hyperledger在復制的私有池模式下工作。 他們的論壇沒有回復,因此這里有問題。 此外,問題純粹是一個技術錯誤。
Hyperledger使用Phoenix,Cowboy,Elixir,Ecto,Erlang,Postgre SQL,Node.js等。主節點處理請求,在一對表中插入一行並向輔助節點廣播消息。 輔助節點執行類似操作,並將消息發送回主節點以繼續處理。 這是問題的起點。 主節點現在嘗試讀取先前插入的行但得到nil結果。 此后拋出以下異常。
** (exit) an exception was raised:
** (RuntimeError) expected :action/2 to return a Plug.Conn
(hyperledger) web/controllers/log_entry_controller.ex:1: Hyperledger.LogEntryController.phoenix_controller_pipeline/2
(hyperledger) lib/phoenix/router.ex:297: Hyperledger.Router.dispatch/2
(hyperledger) lib/phoenix/router.ex:2: Hyperledger.Router.call/2
(hyperledger) lib/hyperledger/endpoint.ex:1: Hyperledger.Endpoint.phoenix_endpoint_pipeline/1
(hyperledger) lib/plug/debugger.ex:90: Hyperledger.Endpoint."call (overridable 3)"/2
(hyperledger) lib/phoenix/endpoint/render_errors.ex:34: Hyperledger.Endpoint.call/2
(phoenix) lib/phoenix/endpoint/cowboy_handler.ex:50: Phoenix.Endpoint.CowboyHandler.upgrade/4
(cowboy) src/cowboy_protocol.erl:435: :cowboy_protocol.execute/4
為什么主節點無法讀取在廣播發送到輔助節點之前插入的內容。 我懷疑與陳舊的數據庫連接或類似的東西有關。 任何幫助將不勝感激。 如果我應該分享更多信息,請告訴我。
你的控制器中有一個沒有返回conn
。 所有操作必須接收conn
並返回更新的conn
。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.