John_Shelby
Hello,
I have a problem after logging in to my app and I don’t know how to solve this error: key :conn not found in: %{__changed__: % in my_app_web/templates/layout/app.html.heex Has anyone encountered this before? I’m upgrading from phoenix from 1.6.9 to 1.7.0 and phoenix_live_view from 17.8 to 18.3.
I don’t know what I should have set wrong. I followed the upgrade instructions or also the video from Elixircast
I checked web.ex and everything from tutorials, but it seems ok.
Has anyone had the same problem please?
Any ideas? Thank you.
Need more information to solve a problem?
Trending in Questions
I’m aware of 2 such projects, are there others?
git: GitHub - team-alembic/realworld: A fullstack Phoenix LiveView application with back...
New
I having some trouble figuring out if I have set myself too strict of standards for my production server. Currently I can handle 75% of r...
New
Hi everyone.
My team and I have been working on a fairly modest app based around video streaming and chat, but we’ve landed a customer t...
New
I really like the adapter patterns that ecto, nebulex, waffle, etc. use and would love find something similar for a key management servic...
New
Hello folks!
So at work, we are seeing some situations where we have to define some “fixed” strings that are used across the codebase in...
New
How Can I Optimise Compile Time Dependencies
I have been building an elixir application for about 2 years now. Many modules and files ha...
New
Hi,
we run different LLM models across a cluster, with each node loading a configurable subset. Model-specific queues let nodes consume ...
New
Other Trending Topics
A little off-topic, but I feel like people here have a good head on their shoulders.
I used to be quite good at making software. Was luc...
New
Hey. Is there anyone here who creates agents in their apps? Not talking about using agents, but creating them. I’m finding it pretty diff...
New
I fully migrated to my own harness from Anthropic/Gemini and I think it’s time to share it. Welcome DSH, the DeepSeek Harness, fully writ...
New
Beam Bots (or just BB for short) is a framework for building fault-tolerant robotics applications in Elixir using familiar OTP patterns. ...
New
There has been a thread to discuss the Stack Overflow Developer Survey on this forum every year since 2018, so here’s yet another one for...
New
I love Elixir. It’s one of 2 programming languages I’ve ever fallen in love with.
But I don’t use it anymore.
Serverless was the promis...
New
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #library
- #deployment
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #elixirconf
- #channels
- #exunit
- #discussion
- #code-sync
- #podcasts
- #javascript
- #onsite
- #dialyzer
- #docker
- #authentication
- #ai
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #blog-post
- #elixirconf-us
- #elixir-ls
- #phoenix_html
- #iex
- #graphql
- #genstage
- #websockets
- #supervisor
- #advent-of-code
- #distillery
- #processes
- #elixirconf-eu
- #api
- #forms
- #security
- #performance











Showing Posts 1 to 10- Show Best Posts
- Show All (oldest first)
- Show All (newest first)
LostKobrakai
I think you want to use a root layout with LV to put everything outside of the html body. Usually that’s in
root.html.heex.John_Shelby
@LostKobrakai I’am so sorry, but But I don’t fully understand the answer. Can you give me some more details please?
More info:
I have 90% on the project without LV. Normally through the Controller. In general, I solve the problem anywhere after the user logs into the application. Everything was fine before the upgrade.
I don’t have root.html because it’s quite an old project and there are a lot of other little things in it. I only have /app.html which looks like this:
in my MyAppWeb.ex:
/router.ex
LostKobrakai
If you’re using LV you should have a
root.html.heexand use that as root template. Leave just the pieces within<body>inapp.html.heex, there rest goes intoroot.html.heex. Everything in the root template is not touched by LV, but everything withinapp.htmlcan be. LV trying to manage head content however won’t go well.root.html.heexwill always receive a@conn, but (if you stick to using it for LV and non-LV)app.html.heexwill either have access to a@connor@socketdepending on the type of page. For all things related to links you can substitute them forMyAppWeb.Endpoint, which works for both types of pages.John_Shelby
I rewrite
app.html.heextoroot.html.heex+app.html.heex+live.html.heexand it help me a lot on most forms. But when I havelive_renderfunction in form (html.heex or controller), I have same error. I tried to replacePhoenix.LiveView.ControllertoPhoenix.Componentbut it didn’t help me.I’m missing the point about the endpoint. Sorry for the misunderstanding.
example:
smathy
Not answering your specific question here, but generally I find the best approach is to use the generator to create two new empty projects, one in the old version and one in the new version and use a
diffof those two as a guide for what to change in your project.John_Shelby
I’ve tried that before, but to no avail.
Just to give you an idea.
The project I’m making changes to is originally based in 2020. Nothing has been done on it for a year. LiveView was handled very differently than it is today. I’m the only one working on the project. I only have an external senior mentor who is currently too busy. And my experience with Elixir is half a year. As a Junior, I’m definitely missing out on a lot of things, but I need to address specific issues because I’m currently stuck after the new year and I’m starting to feel like I’m not keeping up.
smathy
Right, yes, that’s a difficult situation. What I think the problem here is is that you have
@conninside yourheextemplate tags ({}), which is then being processed by LV as a tracked template var, and hence it’s looking for the:connkey in its internal__changed__map (which it can’t find). If you look in a new 1.7 project’sroot.html.heexyou’ll see it’s now using the verified routes~psigil:…so that should solve this problem, but I fear that’ll just lead you to the next, and the next, and the next.
John_Shelby
You are absolutely right. It took me to the next one, specifically
<%= render("navbar.html", conn: @conn, current_user: @current_user) %>which is visible on the original
app.html.heexadded here. So I would have to rewrite everything, if I understand it correctly.I’m adding Endpoint because I don’t understand how Benjamin meant it.
Footnote.
I also tried creating a branch where I overwrote most of the :view to :html, then overwrote all the render/2 functions. I ran into a number of other errors though. For example, it was rendering something according to the new Layouts module and querying LayoutView somewhere, so I had both. Some forms required the new HTML module, but some still queried the old View module and I didn’t know why. I could go on. So I went back to the original tutorial where they kept the View where I’m now struggling with this.
smathy
Yeah, any older or sizable app can be a big challenge to upgrade and yes, will require numerous changes. Honestly, it’s not a task I would usually expect a lone junior to succeed with
AlchemistCamp
I’m also seeing this error in an upgrade to 1.7 and Phoenix Component, but it’s only happening during tests.
I replaced my ErrorView with an ErrorHTML, identical to the one in created by mix phx.new, except that I uncommented the line:
I have an identical App.DataCase to the generated one and an App.ConnCase that is only different in that it imports Route helpers as well as verified routes. Here is my error html test:
Running the tests results in this error:
as well as a very similar one for the 500 test. The previous test were working when the same templates were traditional views.
Edit: In my case the issue was due to the templates actually expecting a
@conn(to pass toRoutes.static_url/2), so it’s not that relevant to this question.But in case anyone else finds this thread via search and is encountering the same issue, the fix in this scenario was to just replace each
@connin the error page templates withAppWeb.Endpoint. This may or may not work for your app depending on what you were doing with the@conn.