version 0.4.3 attempts to sort components by a non-existent path column
Environment
- Elixir version (Elixir 1.17.2 (compiled with Erlang/OTP 27)):
- Phoenix version (1.7.21):
- Phoenix LiveView version (phoenix_live_view 1.0.9):
- Beacon version (beacon 0.5.1):
- Operating system macos
- Browsers on which you attempted to reproduce this bug (the more the merrier):
Actual behavior
What you did (tried to access /admin/<your_site>/components). What you expected (to see a list of components). What actually happened (showed an error - at end). The exact error message and stack trace (which you already have!). Mentioning that your beacon_components table doesn't have a path column (as confirmed by pgAdmin).
mix phx.server output: ##################
↳ :erpc.execute_call/3, at: erpc.erl:1269
[debug] QUERY ERROR source="beacon_components" db=0.0ms queue=8.5ms idle=1171.3ms
SELECT b0."id", b0."site", b0."name", b0."description", b0."body", b0."template", b0."example", b0."category", b0."thumbnail", b0."inserted_at", b0."updated_at" FROM "beacon_components" AS b0 WHERE (b0."site" = $1) ORDER BY b0."path" LIMIT $2 OFFSET $3 [:drpbanerji_brochure, 15, 0]
↳ :erpc.execute_call/3, at: erpc.erl:1269
[debug] failed to call Beacon.Content.list_components(:drpbanerji_brochure, [per_page: 15, page: 1, query: nil, sort: :path]) for site :drpbanerji_brochure on node :nonode@nohost
[error] GenServer #PID<0.1443.0> terminating
** (Beacon.LiveAdmin.ClusterError) failed to call Beacon.Content.list_components(:drpbanerji_brochure, [per_page: 15, page: 1, query: nil, sort: :path]) for site :drpbanerji_brochure on node :nonode@nohost
Got:
Erlang error: {:exception, %Postgrex.Error{message: nil, postgres: %{code: :undefined_column, line: "3718", message: "column b0.path does not exist", position: "225", file: "parse_relation.c", unknown: "ERROR", severity: "ERROR", pg_code: "42703", routine: "errorMissingColumn"}, connection_id: 53052, query: "SELECT b0."id", b0."site", b0."name", b0."description", b0."body", b0."template", b0."example", b0."category", b0."thumbnail", b0."inserted_at", b0."updated_at" FROM "beacon_components" AS b0 WHERE (b0."site" = $1) ORDER BY b0."path" LIMIT $2 OFFSET $3"}, [{Ecto.Adapters.SQL, :raise_sql_call_error, 1, [file: ~c"lib/ecto/adapters/sql.ex", line: 1096, error_info: %{module: Exception}]}, {Ecto.Adapters.SQL, :execute, 6, [file: ~c"lib/ecto/adapters/sql.ex", line: 994]}, {Ecto.Repo.Queryable, :execute, 4, [file: ~c"lib/ecto/repo/queryable.ex", line: 232]}, {Ecto.Repo.Queryable, :all, 3, [file: ~c"lib/ecto/repo/queryable.ex", line: 19]}, {Beacon.Content, :list_components, 2, []}]}
Hi @davidtew thanks for the report. Have you performed any other action other than just visiting /components? I can't reproduce it and can't see how it would sort by path either since that page is fixed to sort by :name. I suspect something else caused list_components to receive sort: :path.