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
Hello!
Suppose you are building workflow (order / task / payment) processing system with the following requirements:
Each workflow con...
New
Hey guys,
I’ve got a huge CSV ( around 10 GB ) that needs to be processed hourly
Do you guys have any suggestions what is the best prac...
New
Kia ora,
We have been using elixir-google-api to connect to Google Drive. However, with the updates to Tesla due to CVEs this is now bro...
New
Hello!
Could someone please give me a help/sample code, how to delete a file from s3 using waffle/waffle_ecto from Phoenix app.
I creat...
New
I have what I’ve heard referred to as a “lookup table” in my database. This is a way of assigning codes to common values. One common lo...
New
Hello,
I’m developing a online persistent chat system (what’s app) like using elixir/dynamodb/aws for a mobile app(flutter).
The diffic...
New
What approach to take when sending live updates to “random” users Hi! I have a question, I have a little chat app, and when I create a DM...
New
Other Trending Topics
Hobbes is a low-level distributed database for the Elixir programming language.
Hobbes provides a simple, safe, and scalable storage lay...
New
ExRatatui lets you cook up rich terminal UIs in Elixir, powered by Rust’s ratatui via Rustler NIFs. Build interactive terminal applicatio...
New
Hello everyone. After busy few months I am happy to announce v0.1.0 of Emerge & Solve.
They are GUI (Emerge) and State management (S...
New
Corex is an accessible, unstyled UI component library for Phoenix that integrates Zag.js state machines using Vanilla JavaScript and Live...
New
There are three potential reasons for members of this forum to have a look at https://vutuv.de
You are tired or annoyed of LinkedIn.
Yo...
New
ICal is a library for interacting with iCalendar data. It parses iCalendars into typed Elixir structs via ICal.from_ics, and can prepare ...
New
Latest Phoenix Threads
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
- #elixirconf
- #channels
- #exunit
- #discussion
- #code-sync
- #javascript
- #podcasts
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #elixir-ls
- #blog-post
- #ai
- #phoenix_html
- #elixirconf-us
- #iex
- #graphql
- #genstage
- #websockets
- #supervisor
- #advent-of-code
- #distillery
- #processes
- #api
- #forms
- #hex
- #security
- #metaprogramming











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.