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! ![]()
Marked As Solved
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
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
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.
Last Post!
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.
Popular in Questions
Other popular topics
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #deployment
- #library
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #channels
- #elixirconf
- #exunit
- #discussion
- #code-sync
- #javascript
- #podcasts
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #elixir-ls
- #phoenix_html
- #iex
- #blog-post
- #graphql
- #genstage
- #ai
- #websockets
- #supervisor
- #elixirconf-us
- #advent-of-code
- #distillery
- #processes
- #forms
- #api
- #metaprogramming
- #security
- #hex









