LionelHutz

LionelHutz

Phoenix.CodeReloader won't compile - Phoenix 1.7.7, 1.7.8

Without (knowingly) changing anything in my workflow, my Elixir/Erlang/Phoenix versions, or any dependencies etc, I suddenly started getting this error when trying to compile my new umbrella project:

== Compilation error in file lib/phxapp/endpoint.ex ==
** (ArgumentError) cannot escape #Function<0.12031047/1 in Phoenix.CodeReloader.init/1>. The supported values are: lists, tuples, maps, atoms, numbers, bitstrings, PIDs and remote functions in the format &Mod.fun/arity
    (elixir 1.15.6) src/elixir_quote.erl:505: :elixir_quote.argument_error/1
    (plug 1.15.1) lib/plug/builder.ex:344: Plug.Builder.init_module_plug/4
    (plug 1.15.1) lib/plug/builder.ex:322: anonymous fn/5 in Plug.Builder.compile/3
    (elixir 1.15.6) lib/enum.ex:2510: Enum."-reduce/3-lists^foldl/2-0-"/3
    (plug 1.15.1) lib/plug/builder.ex:320: Plug.Builder.compile/3
    (plug 1.15.1) expanding macro: Plug.Builder.__before_compile__/1
    lib/phxapp/endpoint.ex:1: Phxapp.Endpoint (module)

(Note - I mentioned this error has started today: it also seems to be affecting only projects built today, as earlier, almost identical projects recompile just fine.)

I’m using Phoenix 1.7.7, and have been for a while. In fact, as said, my process has been rock solid for several weeks - right until this error started appearing.

I tried upgrading to 1.7.8, but that did nothing. I went back to 1.7.7, and it still persists. Only commenting out the invocation of the plug in question (in my endpoint.ex) ‘solves’ it:

 if code_reloading? do
    socket "/phoenix/live_reload/socket", Phoenix.LiveReloader.Socket
    plug Phoenix.LiveReloader
    #plug Phoenix.CodeReloader
  end

However - I have noticed that the error seems to occur under only one project structure (of those I’ve tried). I usually build my apps via:

$ mix new app_name --umbrella
$ cd app_name/apps
$ mix phx.new.web web_app_name --no-ecto
$ mix phx.new.ecto ecto_app_name

This structure has served me well for months, right up until today. But now I get the compile error. However, if I do something like:

$ mix phx.new app_name --umbrella

or

$ mix phx.new app_name

etc, then everything works just fine? I see in the changelogs of the Phoenix repo that some changes were indeed made to Phoenix.CodeReader the day before/day of when this error started appearing - perhaps they’re the root of it?:

https://github.com/phoenixframework/phoenix/blob/main/CHANGELOG.md

Further, it seems like some other people are facing it, too:

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

Anyone else have any thoughts/experience with this error?

Thanks

Marked As Solved

chrismccord

chrismccord

Creator of Phoenix

Fix was released with 1.7.9

Also Liked

LostKobrakai

LostKobrakai

The fix hasn’t been made part of a versioned release yet. There aren’t new releases being made for individual bug fixes. 1.7.9 will eventually include it.

benwilson512

benwilson512

Author of Craft GraphQL APIs in Elixir with Absinthe

Hi @LionelHutz first as a basic sanity check can you rm -rf _build and see if the issue persists? Beyond that, what version of Elixir are you using?

josevalim

josevalim

Creator of Elixir

@LionelHutz it is a bug, I will fix it. :slight_smile:

Where Next?

Popular in Questions Top

chokchit
** (DBConnection.ConnectionError) connection not available and request was dropped from queue after 2733ms. You can configure how long re...
New
lastday4you
I wanted to check elixir version in phoenix because i found that my elixir is 1.5 but when i use Enum.chunk_by it said the function is un...
New
marius95
Hello everyone, I try to use an Javascript Event Handler in my root.html.leex file. Therefore I created a function in the app.js file: ...
New
chrisalley
ExUnit now has describe blocks which is a welcome addition coming from RSpec. In the docs, it states that nested hierarchies of describe ...
New
lessless
I believe there are people here who are dealing with CSV files import on the daily basis, and since Excel is a really popular tool there ...
New
johnnyicon
Hi all, I’ve just started learning Elixir and Phoenix Framework, so please pardon my n00bness at this stage. I’m trying to use Postgres...
New
aalberti333
As the title describes, I’m trying to run Enum.map() over a list of key/value pairs, where the value is a map. My data looks like this: ...
New
PeterCarter
There are pre-rolled solutions for other frameworks that do work. However, Phoenix does not seem to have these. Have people had good expe...
New
jaysoifer
Is there a way to rollback a specific migration and only that one (“skipping” all the other ones)? Would mix ecto.rollback -v 200809061...
New
vegabook
I’m brand new to Phoenix and I have stripped one of the demo applications to the bone. I just want to get an svg up on the screen. Here i...
New

Other popular topics Top

electic
Hi, I am new to Elixir. I am trying to use the DateTime component to insert a date into MySQL however the there seems to be no way to fo...
New
Darmani72
If I have a post route which an argument: post /my_post_route/:my_param1, MyController.my_post_handler How would get the post params ...
New
pmjoe
I have a relationship of love and hate with Elixir. Lots of things are just absolutely right, but there are some things that are kind of ...
New
Fl4m3Ph03n1x
About me? ( if you have nothing better to do than reading about some random guy in the internet :stuck_out_tongue: ) Hello all, this is ...
New
msaraiva
Surface is an experimental library built on top of Phoenix LiveView and its new LiveComponent API that aims to provide a more declarative...
564 43806 214
New
Lily
In templates/appointment/index.html.eex: &lt;%= for appointment &lt;- @appointments do %&gt; &lt;tr&gt; &lt;td&gt;&lt;%= appoi...
New
jay1
Why is it that the mnesia database isn’t the most preferred database for use in Elixir/Phoenix?
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
Qqwy
Update: How to use the Blogs &amp; Podcasts section You can post links to your blog posts or podcasts either in one of the Official Blog...
3271 127536 1222
New
sergio
Kind of like when jquery came out, it was super necessary. Existing drag and drop libraries have a bunch of baggage to support old browse...
New

We're in Beta

About us Mission Statement