John_Shelby

John_Shelby

Compile error specific only for my Mac

Hi, I have a problem with compiling a project on my Mac. I’m experiencing the problem through all branches that were originally executable and no changes were made to them. Suddenly everything stopped working and I honestly have no idea what action could have caused this problem.

== Compilation error in file lib/my_app_web/controllers/user_switch_role_controller.ex ==
** (ArgumentError) defdelegate function is calling itself, which will lead to an infinite loop. You should either change the value of the :to option or specify the :as option
  (elixir 1.14.3) lib/kernel/utils.ex:32: Kernel.Utils.defdelegate_all/3
  /Users/username/Documents/Folder1/my_app/lib/my_app_web/controllers/user_switch_role_controller.ex:1: (file)
  (stdlib 4.2) erl_eval.erl:748: :erl_eval.do_apply/7
  (stdlib 4.2) erl_eval.erl:492: :erl_eval.expr/6
  (stdlib 4.2) erl_eval.erl:136: :erl_eval.exprs/6
  (filterable 0.7.4) /Users/username/Documents/Folder1/my_app/lib/my_app_web/controllers/user_switch_role_controller.ex:1: Filterable.__before_compile__/1

On my friend’s Mac everything is working fine. We both have a Mac M1 with OS Ventura 13.2.1. I can compile the same project on a Linux virtual machine without any problem.

Tool versions:
erlang 25.2.3
elixir 1.13.4-otp-25
nodejs 12.22.12
Steps I tried.

  • Uninstalling Elixir, Elrang and NodeJS, then the whole asdf. And then installing asdf and reinstalling Elixir, Erlang and NodeJS via asdf.
  • Reinstalling xcode.
  • Clone the project to a new folder

This is code from controller. Only def action.

defmodule MyAppWeb.UserSwitchRoleController do
 use MyAppWeb, :controller
 use Filterable.Phoenix.Controller

 alias MyApp.Users
 alias MyApp.Users.User

 def edit(conn, current_user, %{"id" => id}) do
  user = Users.get_user!(id)

  live_render(conn, MyAppWeb.UserLive.EditOwnRole, session: %{"user" => user})
 end

 def update(conn, current_user, %{"id" => id, "user" => user_params}) do
  user = Users.get_user!(id)

  case Users.update_user(user, user_params) do
   {:ok, user} ->
    conn
    |> put_flash(:info, gettext("User updated successfully."))
    |> redirect(to: Routes.user_switch_role_path(conn, :edit, user))

   {:error, %Ecto.Changeset{} = changeset} ->
    render(conn, "edit_own_role.html", user: user, changeset: changeset)
  end
 end

 def action(conn, _) do
  args = [conn, conn.assigns.current_user, conn.params]
  apply(__MODULE__, action_name(conn), args)
 end
end

I have defdelegate elsewhere in the app, but when I went through them, none of them even refer to the controller.
If it was explicitly a code error, wouldn’t it show up on a second Mac with the same setup?

Error def is here:
https://github.com/elixir-lang/elixir/blob/main/lib/elixir/lib/kernel/utils.ex

Anyone got any ideas? I would be glad for any help. :slightly_smiling_face:
Thanks.

Marked As Solved

al2o3cr

al2o3cr

The commit message doesn’t have much explanation, but I think this commit is related:

https://github.com/omohokcoj/filterable/pull/18

It adds an as: to the defdelegate in Filterable, which is brought in by Filterable.Phoenix.Controller.

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
albydarned
Hello all! I am typing this post from my new MacBook Pro with the M1 chip. I’m loving it so far, and will probably use it as my daily dr...
New
myronmarston
The Elixir Typespec docs show the following syntax for keyword lists in typespecs: # ... | [key: type] # keyword lists...
New
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
tduccuong
Hi, is there any work on GUI with Elixir, that is similar to Electron/Javascript? My idea is to bundle Phoenix and BEAM into a single se...
New
JDanielMartinez
Hi! May someone helps me, please! I have two apps into an umbrella project: the first one is Database, which manages queries, and the se...
New
nobody
Hi! In PHP: $_SERVER[‘SERVER_ADDR’] - in Elixir? Searched the docs for ip address and the web, no good results. Thanks!
New
Brian
What is the proper way to load a module from a file in to IEX? In the python world, doing something like this pretty standard: from ....
New
dotdotdotPaul
Okay, I’m having a heck of a time trying to figure out how to best handle the validation of belongs_to associations in Ecto. I’m sure I’...
New
vonH
In asking this question I am more interested about the expressiveness of the language itself and less concerned about the availability of...
New

Other popular topics Top

danschultzer
None of the current solutions worked well for me, so I went ahead and built a user management system from scratch. This project took far...
548 29377 241
New
malloryerik
Hi, this is for people who, like me, have had some friction using .html.heex templates in VSCode. The solution seems to be, in a hyphena...
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
JeremM34
Hello, how can I check the Phoenix version ? Thanks !
New
minhajuddin
I have seen a lot of code which picks the first element from a list using Enum.at(0) instead of List.first. Is there a reason why people ...
New
jay1
Why is it that the mnesia database isn’t the most preferred database for use in Elixir/Phoenix?
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
vonH
When I run the Plug and I recompile I wind up having to use Ctrl C to quit iex and start again. Witht the help of rlwrap I can use the cu...
New
grych
Hi folks, Few months ago I have announced the proof-of-concept of the library to manipulate the browsers DOM objects directly from Elixi...
639 52341 488
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