manhtranlinh

manhtranlinh

Key :inner_content not found in /../components/layouts/app.html.heex

Hi every one, with my current setup, I have an error with default registration page after run mix phx.gen.auth.

❯ elixir --version
Erlang/OTP 28 [erts-16.1.1] [source] [64-bit] [smp:12:12] [ds:12:12:10] [async-threads:1] [jit:ns]

Elixir 1.19.3 (compiled with Erlang/OTP 28)

mix.exs file: defp deps do

\[

  {:argon2_elixir, "\~> 4.0"},

  {:phoenix, "\~> 1.8.1"},

  {:phoenix_ecto, "\~> 4.5"},

  {:ecto_sql, "\~> 3.10"},

  {:postgrex, ">= 0.0.0"},

  {:phoenix_html, "\~> 4.1"},

  {:phoenix_live_reload, "\~> 1.2", only: :dev},

  {:phoenix_live_view, "\~> 1.1.17"},

  {:floki, ">= 0.30.0", only: :test},

  {:phoenix_live_dashboard, "\~> 0.8.3"},

  {:esbuild, "\~> 0.8", runtime: Mix.env() == :dev},

  {:tailwind, "\~> 0.2", runtime: Mix.env() == :dev},

  {:heroicons,

github: “tailwindlabs/heroicons”,

tag: “v2.1.1”,

sparse: “optimized”,

app: false,

compile: false,

depth: 1},

  {:swoosh, "\~> 1.5"},

  {:finch, "\~> 0.13"},

  {:telemetry_metrics, "\~> 1.0"},

  {:telemetry_poller, "\~> 1.0"},

  {:gettext, "\~> 1.0.1"},

  {:jason, "\~> 1.2"},

  {:dns_cluster, "\~> 0.2.0"},

  {:bandit, "\~> 1.5"}

\]

end
router.ex file:

scope “/”, AppWeb do

pipe_through \[:browser\]



live_session :current_user,

on_mount: [{AppWeb.UserAuth, :mount_current_scope}] do

  live "/users/register", UserLive.Registration, :new

  live "/users/log-in", UserLive.Login, :new

  live "/users/log-in/:token", UserLive.Confirmation, :new

end

post "/users/log-in", UserSessionController, :create

delete "/users/log-out", UserSessionController, :delete

end

When use mix phx.gen.auth, the generator generate new version of registration.ex, use Layouts.app, but there is error:

KeyError at GET /users/register
key :inner_content not found in:

    %{
      current_scope: nil,
      inner_block: [
        %{
          inner_block: #Function<2.48550011/2 in AppWeb.UserLive.Registration.render/1>,
          __slot__: :inner_block
        }
      ],
      flash: %{},
      __changed__: nil
    }

Please help to resolve this.

Thanks! :smiley:

Marked As Solved

garrison

garrison

I assume the actual issue here is that you generated the project with the 1.7 installer and then ran the 1.8 mix phx.gen.auth?

If this is a blank project then just regenerate it with the newer installer and start over. If this is an existing app then you can either switch to the newer Layouts approach or modify the generated auth code to use the old approach. I would choose the former as the new approach is better.

Also Liked

Hermanverschooten

Hermanverschooten

You probably have @inner_content in your layout html, but I believe that when you call your layout as a function you have to use render_slot(@inner_block)

Have you tried without the Layouts.app? The recent versions of Phoenix use layouts differently and the generators assume your app does too, but if you are still set up in the previous way you may not need the Layouts.app.

Hermanverschooten

Hermanverschooten

What is in your layouts.ex file?

manhtranlinh

manhtranlinh

Thanks all,

I had create an issue and known that I forgot to upgrade from phoenix project from 1.7.14 to 1.8.1.

https://github.com/phoenixframework/phoenix/issues/6545

Last Post!

manhtranlinh

manhtranlinh

Thanks all,

I had create an issue and known that I forgot to upgrade from phoenix project from 1.7.14 to 1.8.1.

https://github.com/phoenixframework/phoenix/issues/6545

Where Next?

Popular in Questions Top

vonH
When I run the Plug and I recompile I wind up having to use Ctrl C to quit iex and start again. Witht the help of rlwrap I can use the cu...
New
hariharasudhan94
I would like to know what is the best IDE for elixir development?
New
ashish173
I am using Ecto timestamps with postgres, I can see the timestamps() use the :naive_dateime but for my use case I wanted to store the ti...
New
sergio_101
I am VERY much an elixir newbie. I have taken one elixir course and one phoenix course on Udemy. During that course, I saw the instructor...
New
komlanvi
Hi everyone, I was playing with phoenix liveView but I run into an issue. I have a form and want to validate each input text when the te...
New
freewebwithme
Using vs code and installed ElixirLS: support and debugger. And I got an error popped up on start up says Failed to run ‘elixir’ comma...
New
fayddelight
I tried installing elixir 1.11.2 erlang 23.3.4 via asdf in my zsh shell. Enabled the versions locally and globally. When I list them ...
New

Other popular topics Top

minhajuddin
I have seen a lot of code which picks the first element from a list using Enum.at(0) instead of List.first. Is there a reason why people ...
New
jononomo
I am trying to figure out how Mix knows whether the environment is test, dev, or prod – where is this set? Thanks.
New
New
alice
Hey, Just curious what are the main benefits of Elixir compared to Clojure? When is Elixir more useful than Clojure and vice versa? Th...
New
WestKeys
Currently suffering from paralysis by [HTTP client] analysis. This is rather unusual in Elixirland as there tends to be consensus on the ...
New
JorisKok
I have a server on AWS, and was running a load test using artillery. When looking at the Phoenix dashboard I see the Ports going to 100% ...
New

We're in Beta

About us Mission Statement