Strange error with LiveView socket and CSRF

I’ve now attempted the following:

  1. I ran mix clean --all, mix deps.get and mix deps.compile to ensure I didn’t have any borked dependencies.
  2. I ran rm -rf assets/node_modules, npm i --no-save --prefix assets to ensure I didn’t have any borked node modules.
  3. I’ve switched to using the MnesiaCache backend for Pow.

None of these things solved my issue and I still see the same debug message in my logs and the same pattern of page reloads. I added some calls to IO.inspect within the phoenix_live_view dependency and my problem seems to be that the created %Phoenix.Socket{} has no session information. The logged value of the socket is:

%Phoenix.Socket{
  assigns: %{},
  channel: Phoenix.LiveView.Channel,
  channel_pid: nil,
  endpoint: MyApp.Endpoint,
  handler: Phoenix.LiveView.Socket,
  id: nil,
  join_ref: "4",
  joined: false,
  private: %{connect_info: %{session: nil}},
  pubsub_server: MyApp.PubSub,
  ref: nil,
  serializer: Phoenix.Socket.V2.JSONSerializer,
  topic: "lv:phx-FjRz-igtqSANgQ2k",
  transport: :websocket,
  transport_pid: #PID<0.832.0>
}