jle

jle

Hi, I have a problem in one computer with applications running liveview

It has to be a problem with my computer configuration

The same application running on different computers works perfectly

I also ran the examples from Chris McCord with same problem
All these worked some days ago

I tested with firefox and chrome with same behaviour

I tested with elixir 12 and 13. No surprises it didn’t work with both, I’m sure it has to be a configuration problem in my computer

My question is about how to try to debug this issue

I added this trace on mount

  def mount(_params, _session, socket) do
     ...
    Logger.info("_____________ connected?(socket) #{connected?(socket)}")
    ...

and this is the output

[info] Running DemoWeb.Endpoint with cowboy 2.9.0 at 0.0.0.0:4000 (http)
[info] Access DemoWeb.Endpoint at http://localhost:4000
[watch] build finished, watching for changes...
[info] CONNECTED TO Phoenix.LiveView.Socket in 64µs
  Transport: :websocket
  Serializer: Phoenix.Socket.V2.JSONSerializer
  Parameters: %{"_csrf_token" => "bDccJkAePU00HgMdJj8GPgAgNFgqXBwXYm-OmNl4UXdHkG4VthU6L6xg", "vsn" => "2.0.0"}
[info] GET /
[debug] Processing with Phoenix.LiveView.Plug.Elixir.DemoWeb.ImageLive/2
  Parameters: %{}
  Pipelines: [:browser]
[info] _____________ connected?(socket) false
[info] Sent 200 in 68ms
[info] CONNECTED TO Phoenix.LiveView.Socket in 53µs
  Transport: :websocket
  Serializer: Phoenix.Socket.V2.JSONSerializer
  Parameters: %{"_csrf_token" => "RH4FFgYQDjAOXy1QBidWKAVzFgIDLC4n450cwzwahoHbuU7EwGSKdJB_", "vsn" => "2.0.0"}

Any tip of how could I investigate where the problem is?
Thanks (marvellous language, phoenix is impressive, nice community… congrats!!!)

Showing Posts 47 to 38

jle

jle OP

Sadly I cannot reproduce the problem any more :frowning:

After moving .cache to .cache.old and deleting priv/static/assets, it worked (assets where regenerated on mix phx.server correctly)

Then I deleted .cache and moved back .cache.old to .cache, and deleted again priv/static/assets in order to reproduce the problem and investigate what was producing this behavour… but… it didn’t fail anymore :frowning:

I’ve created a new project with the “original and perhaps corrupted cache”, and everything is working fine

Perhaps, I did a mistake, and I didn’t close a browser when manipulating .cache folder. Not sure

I’m not happy because I cannot reproduce the problem and try to understand the exact point that produced it. I also was interested on checking if could be possible to have better information on phoenix side when problems arrive.

The app.js as derek-zhou detected was wrong, probably because someone (esbuild?) was getting an old and invalid version from .cache
After manipulating this folder… it worked due to… don’t know, could be due to updated timestamps, running application…

Thank to all of you, I learned a lot trying to understand this problem

jle

jle OP

ALMOST SOLVED!!!

I’ve moved the full .cache folder to a new name, and it’s WORKING!!!

now I’m going to check what is producing this inside this folder

jle

jle OP

BUM!!!
They are different!!! quite different

I cannot put the differences here because is a huge file and there are many differences
I have no idea of what can be happening with esbuild, I’m going to try to investigate and try to solve it

I’ll keep you informed if I can get any advance about it
Regards

derek-zhou

derek-zhou

Now you have the same project, built in 2 different machines, one working, one not working. Can you compare priv/static/assets/app.js from the 2 machines. Are they the same? If not, then your esbuild did not do the right thing on the bad machine.

jle

jle OP

I’ve deleted cache, not fixed :frowning:
I’ve moved full browser folder (chromium and firefox), therefore starting with a new instalation, same behaviour

I’ve installed brave browser, and no changes :frowning:
Liveview doesn’t work, and liveSocket returns root instead of roots :open_mouth:

jle

jle OP

good point about root vs roots

I runned on a “normal” computer, and the exit of liveView is…

LiveSocket {unloaded: false, socket: Socket, bindingPrefix: 'phx-', opts: {…}, params: ƒ, …}
activeElement: null
bindingPrefix: "phx-"
boundTopLevelEvents: true
currentLocation: {ancestorOrigins: {…}, href: 'http://localhost:4000/', origin: 'http://localhost:4000', protocol: 'http:', host: 'localhost:4000', …}
defaults: {debounce: 300, throttle: 300}
domCallbacks: {onNodeAdded: ƒ, onBeforeElUpdated: ƒ}
hooks: {}
href: "http://localhost:4000/"
linkRef: 1
loaderTimeout: 1
localStorage: Storage {length: 0}
main: View {liveSocket: LiveSocket, flash: null, parent: null, root: View, el: div#phx-FsWg_mP454K4MwBh.phx-connected, …}
metadataCallbacks: {}
opts: {params: {…}}
params: ƒ ()
pendingLink: null
prevActive: null
roots: {phx-FsWg_mP454K4MwBh: View}
sessionStorage: Storage {length: 0}
silenced: false
socket: Socket {stateChangeCallbacks: {…}, channels: Array(1), sendBuffer: Array(0), ref: 4, timeout: 10000, …}
transitions: TransitionSet {transitions: Set(0), pendingOps: Array(0)}
unloaded: false
uploaders: {}
viewLogger: undefined
[[Prototype]]: Object

There are some diferences

wanton7

wanton7

Anyway your JavaScript file your browser gets is quite likely from old LiveView. Now you just have to find out why this is happening. I would close all tabs and clear browser cache.

jle

jle OP

same project on different machine has enableDebug and runs as espected

These are dependencies on mix.exs

      {:phoenix, "~> 1.6.5"},
      {:phoenix_html, "~> 3.0"},
      {:phoenix_live_reload, "~> 1.2", only: :dev},
      {:phoenix_live_view, "~> 0.17.5"},

The client (browser) console, propose in autocompletio enableDebug (twice), but it returns an error when invoqued

wanton7

wanton7

If you look at phoenix_live_view/assets/js/phoenix_live_view/live_socket.js at 1480b49e52e973f551c88bede2f802e5f5d8c298 · phoenixframework/phoenix_live_view · GitHub

You can see that LiveSocket should have function called enableDebug
also your object has field root but newest LiveSocket should have field called roots phoenix_live_view/assets/js/phoenix_live_view/live_socket.js at 1480b49e52e973f551c88bede2f802e5f5d8c298 · phoenixframework/phoenix_live_view · GitHub

I don’t think you are running the latest LiveView. I just created new project with latest LiveView and object has field roots.

By running mix phx.new --version I get Phoenix installer v1.6.5.

jle

jle OP

This is the result of executing liveSocket on console

e2 {unloaded: false, socket: Socket, bindingPrefix: 'phx-', opts: {…}, views: {…}, …}
activeElement: null
bindingPrefix: "phx-"
currentLocation: {ancestorOrigins: {…}, href: 'http://localhost:4002/new_oper', origin: 'http://localhost:4002', protocol: 'http:', host: 'localhost:4002', …}
hooks: {}
href: "http://localhost:4002/new_oper"
linkRef: 0
main: null
opts: {params: {…}}
params: ƒ ()
pendingLink: null
prevActive: null
prevInput: null
prevValue: null
root: null
silenced: false
socket: Socket {stateChangeCallbacks: {…}, channels: Array(0), sendBuffer: Array(0), ref: 4, timeout: 10000, …}
unloaded: false
viewLogger: undefined
views: {}
[[Prototype]]: Object

Where Next? Top

Trending in Questions Top

RSP87
I’m working on a project that simulates the bumbl example in the programming phoenix book. It acts almost like an email client. We have a...
New
nseaSeb
Hello, I know there is an approach for handling lists that allows for optimized traversal, but I can’t recall the specific method (somet...
New
brecabral
Documentation While reading the Scoped Routes section, I noticed that the documentation currently refers to a problem without explainin...
New
kpanic
Hi everyone, I am toying with the idea of building a “match maker” for giving personal help to people that wants to start coding. I sta...
New
velrest
So my question is quite simple and i have found no conclusive answer on forum, google or AI. Should we use :erlang.float for Integer to ...
New
asweet-confluent
I recently noticed that Elixir’s Logger defaults its primary log level to :debug when no :logger, :level application configuration is pre...
New
apz
I’m new to elixir and just tried to install the elixirLS extension for VScode(ium) and it is throwing some errors that I would like help ...
New

Other Trending Topics Top

GenericJam
Edit: 2026 May 15 - This post is archived. Mob is alive!! Main docs: mob v0.7.11 — Documentation A bit of explanation for the slightly c...
New
JesseHerrick
Hey, I’m Jesse and I’m the main contributor behind Dexter, a full-featured, lightning-fast Elixir LSP optimized for large codebases. It s...
New
mudasobwa
I am happy to introduce the very α version of the new programming language compiled to BEAM. Welcome Cure. It has literally three kille...
New
garrison
Hobbes is a low-level distributed database for the Elixir programming language. Hobbes provides a simple, safe, and scalable storage lay...
New
marciok
Hi there! We created Gust: A task orchestrator inspired by Airflow. For those who have never heard about Aiflow, it’s a Python-based wor...
New
mhanberg
Hi everyone! The first release candidate for the Expert language server project is now available! We’ve published a press release detai...
New

We're in Beta

About us Mission Statement

Options

Thread Display Mode




Thread Preview

Skip Thread Previews