Error : Plug.Exception is not implemented after upgrading to plug 1.14

Hi All,

I have upgraded Phoenix to 1.5.14 and plug 1.14.

I am getting below error after upgrading.

warning: function actions/1 required by protocol Plug.Exception is not implemented (in module Plug.Exception.Plug.CSRFProtection.InvalidCSRFTokenError)
lib/my_test/plug_exception.ex:1: Plug.Exception.Plug.CSRFProtection.InvalidCSRFTokenError (module)

In plug_exception.ex :

defimpl Plug.Exception, for: Plug.CSRFProtection.InvalidCSRFTokenError do
def status(_exception), do: 422
end

endpoint.ex:

plug Plug.Session, @session_options

@session_options [
store: :cookie,
key: “_my_test_key”,
signing_salt: “osdfdsfsdc”
]

Please help to resolve this issue.

Hi, the Plug.Exception — Plug v1.14.2 cover the question you’re asking. There was a new function added that must be included in your defimpl.

1 Like