Closed dfalling closed 1 year ago
As a sanity check, can you mix clean
and retry?
Ah I forgot to try that before, but that doesn't fix it. Here are all my deps.
Can you try removing _build entirely? I cannot reproduce this
No-go on that either. I also deleted my deps
foldere.
Here's the full output of my mix phx.server
. There are some deprecation warnings from dependencies but nothing that sticks out to me:
I also had this problem with the following error:
** (ArgumentError) cannot escape #Function<0.108744951/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
Erlang/OTP 24 [erts-12.3.2.10] [source] [64-bit] [smp:12:12] [ds:12:12:10] [async-threads:1] [jit]
Elixir 1.14.2 (compiled with Erlang/OTP 24)
- Plugin used in `code_reloading?`
plug Phoenix.CodeReloader
- O.S
Ubuntu 22.04.1 LTS
Downgrading phoenix from `1.7.8 -> 1.7.7` solved the issue
I'm also experiencing the error, on a fresh umbrella project. I tried 1.7.6, 1.7.7, 1.7.8 and all have the same result.
These are the commands I ran:
$ mix new --umbrella happyraul
$ cd happyraul/apps
$ mix phx.new.web web
$ cd web
$ iex -S mix phx.server
Compiling 12 files (.ex)
== Compilation error in file lib/web/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/web/endpoint.ex:1: Web.Endpoint (module)
Started receiving this problem this afternoon, too. Same error message. But - changing to Phoenix 1.7.7 unfortunately hasn't helped (in fact, it started under 1.7.7 today (which I've been using for a long while with no issues), so I upgraded to 1.7.8 in case that helped - it didn't. I've downgraded to 1.7.7 just in case, but of course to no avail). Moreover, I don't recall changing anything about my setup before the issue started - so, I'm guessing something changed (perhaps today) on some package's end, and hex now pulls that latest version, which has the issue? Only commenting out the plug in my Endpoint 'solves' it:
#plug Phoenix.CodeReloader
But obviously this is problematic.
Note - it seems to be only happening (as far as I can tell) for me under a certain project structure. For historical reasons, the way I build my apps is:
$ 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
$ cd ../
$ mix deps.get
$ mix compile (or, mix phx.server - the error occurs whenever it tries to compile)
I recognise that's less conventional than, say, mix phx.new app_name --umbrella
, but it's the structure I've used just fine for ages, until... literally this afternoon.
But when I now build little test apps in other ways:
$ mix phx.new app_name --umbrella
$ mix phx.new app_name
this issue isn't present, and all is well? Will be keen to see what's caused this conundrum and hopefully what solves it.
Elixir version:
Erlang/OTP 26 [erts-14.1] [source] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:1] [jit:ns]
Elixir 1.15.6 (compiled with Erlang/OTP 26)
OS:
Windows 10 Pro
I'm also experiencing the error, on a fresh umbrella project. I tried 1.7.6, 1.7.7, 1.7.8 and all have the same result.
These are the commands I ran:
$ mix new --umbrella happyraul $ cd happyraul/apps $ mix phx.new.web web $ cd web $ iex -S mix phx.server Compiling 12 files (.ex) == Compilation error in file lib/web/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/web/endpoint.ex:1: Web.Endpoint (module)
When I build my apps with the same project structure as you (and that same sequence of mix commands thus), I get the error - but when I create my project with one of the other standard structures, like doing $ mix phx.new app_name --umbrella
or $ mix phx.new app_name
, everything works? Have you experienced this? Thanks.
@PatrickLTew Yes, using mix phx.new app_name --umbrella
or mix phx.new app_name
works for me (compiles without error) as well.
Same problem here:
== Compilation error in file lib/my_app_web/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/my_app_web/endpoint.ex:1: MyAppWeb.Endpoint (module)
Phoenix version:
phoenix 1.7.8
Elixir and OTP version (with asdf current
):
elixir 1.15.6-otp-26
erlang 26.1.1
Update: 2 solutions worked well:
Downgrade Phoenix to 1.7.7
or keep Phoenix to 1.7.8
and adding :reloader
keyword to plug configuration inside endpoint.ex:
plug Phoenix.CodeReloader, reloader: &Phoenix.CodeReloader.reload/1
Fixed in main by 7b8575d6158ec1d2fae2bcd8049814a6f88c3bee, sorry about that.
Please confirm it works for you and we will ship a new release. :)
All fixed, thank you !
@PatrickLTew Yes, using
mix phx.new app_name --umbrella
ormix phx.new app_name
works for me (compiles without error) as well.
Ok great, thanks for confirming.
Please confirm it works for you and we will ship a new release. :)
Awesome, thanks! :) In case anyone else is still stuck on this, you have to (for now, until the Phoenix 1.7.9 Hex package is eventually released) reference GitHub as the source of your Phoenix dependency. So, in your mix.exs replace the default:
{:phoenix, "~> 1.7"},
with
{:phoenix, github: "phoenixframework/phoenix", branch: "main", override: true},
At least, that's what I'm having to do.
Thanks again for the fix
{:phoenix, github: "phoenixframework/phoenix", branch: "main", override: true},
I prefer to pin the github dependency to a particular commit, in case newer commits to the branch introduce unintended consequences to the app.
{:phoenix, github: "phoenixframework/phoenix", ref: "7b8575d6158ec1d2fae2bcd8049814a6f88c3bee", override: true},
Environment
Elixir 1.15.4 (compiled with Erlang/OTP 24)
== Compilation error in file lib/ido_web/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.4) 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.4) 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/ido_web/endpoint.ex:1: IdoWeb.Endpoint (module)