Auto-reload and error with deserialization

Hello everyone!
I created a website and I have this problem

I have a page that reloads automatically but I don’t reload it, when I look in the terminal it gives me this error

**(ArgumentError) cannot deserialize #Function<0.23038300/1 in Plug.CSRFProtection.call/2>, term is not safe for deserialization

I need your help please as I tried to fix this problem myself but nothing works

Thanks a lot for your help! :smiley:

1 Like

The rest of the error will say what file and line of your code is causing the error. If you post that part we may be able to help you.

1 Like

This is the full error

 ** (ArgumentError) cannot deserialize #Function<0.23038300/1 in Plug.CSRFProtection.call/2>, the term is not safe for deserialization
        (plug_crypto 1.2.2) lib/plug/crypto.ex:80: Plug.Crypto.non_executable_terms/1
        (plug_crypto 1.2.2) lib/plug/crypto.ex:87: Plug.Crypto.non_executable_list/1
        (plug_crypto 1.2.2) lib/plug/crypto.ex:66: anonymous fn/3 in Plug.Crypto.non_executable_terms/1
        (stdlib 3.17.1) maps.erl:410: :maps.fold_1/3
        (plug_crypto 1.2.2) lib/plug/crypto.ex:66: anonymous fn/3 in Plug.Crypto.non_executable_terms/1
        (stdlib 3.17.1) maps.erl:410: :maps.fold_1/3
        (plug_crypto 1.2.2) lib/plug/crypto.ex:66: anonymous fn/3 in Plug.Crypto.non_executable_terms/1
        (stdlib 3.17.1) maps.erl:410: :maps.fold_1/3
        (plug_crypto 1.2.2) lib/plug/crypto.ex:99: Plug.Crypto.non_executable_tuple/2
        (plug_crypto 1.2.2) lib/plug/crypto.ex:51: Plug.Crypto.non_executable_binary_to_term/2
        (plug_crypto 1.2.2) lib/plug/crypto.ex:322: Plug.Crypto.decode/2
        (phoenix_live_view 0.15.5) lib/phoenix_live_view/static.ex:62: Phoenix.LiveView.Static.verify_token/2
        (phoenix_live_view 0.15.5) lib/phoenix_live_view/static.ex:42: Phoenix.LiveView.Static.verify_session/3
        (phoenix_live_view 0.15.5) lib/phoenix_live_view/channel.ex:746: Phoenix.LiveView.Channel.mount/3
        (phoenix_live_view 0.15.5) lib/phoenix_live_view/channel.ex:57: Phoenix.LiveView.Channel.handle_info/2
        (stdlib 3.17.1) gen_server.erl:695: :gen_server.try_dispatch/4
        (stdlib 3.17.1) gen_server.erl:771: :gen_server.handle_msg/6
        (stdlib 3.17.1) proc_lib.erl:226: :proc_lib.init_p_do_apply/3

Seems like your session data for LV includes an anonymous function, which is not allowed.

2 Likes