在Guardian管道中未设置(RuntimeError)`module`。如何解决这个问题?

时间:2018-09-06 12:59:52

标签: reactjs elixir phoenix-framework phoenix guardian

Github link我的项目。

The Tutorial I am following

这是我的api(phoenix服务器)终端上的错误

[error] #PID<0.560.0> running Slicker.Endpoint terminated
Server: localhost:4000 (http)
Request: POST /api/users
** (exit) an exception was raised:
    ** (RuntimeError) `module` not set in Guardian pipeline
        lib/guardian/plug/pipeline.ex:240: Guardian.Plug.Pipeline.raise_error/1
        lib/guardian/plug/verify_header.ex:84: Guardian.Plug.VerifyHeader.call/2
        (slicker) web/router.ex:12: Slicker.Router.api/2
        (slicker) web/router.ex:1: Slicker.Router.match_route/4
        (slicker) web/router.ex:1: Slicker.Router.do_call/2
        (slicker) lib/slicker/endpoint.ex:1: Slicker.Endpoint.phoenix_pipeline/1
        (slicker) lib/plug/debugger.ex:123: Slicker.Endpoint."call (overridable 3)"/2
        (slicker) lib/slicker/endpoint.ex:1: Slicker.Endpoint.call/2
        (plug) lib/plug/adapters/cowboy/handler.ex:15: Plug.Adapters.Cowboy.Handler.upgrade/4
        (cowboy) /media/ankit/FE3055EB3055AB81/project/slicker/api/deps/cowboy/src/cowboy_protocol.erl:442: :cowboy_protocol.execute/4

1 个答案:

答案 0 :(得分:0)

我认为您需要将其添加到管道中

plug Guardian.Plug.Pipeline, module: App.Guardian, error_handler: App.Web.SessionController

您还应该检查您使用的是与教程使用的版本相同的Guardian。与该库的早期版本相比,他们对Guardian 1.0版进行了许多更改。