electric-sql / electric-sql/phoenix_sync

The path {:conn, [line: 1], Plug.Builder} is not a valid table name and no `:table` option passed.

Open
#22 1 comment 0 reactions 0 assignees View on GitHub
bug
Dominant language
Elixir
Stars
290
Forks
17
PR merge metrics
No merged PRs in 30d

Description

Using this mix file:
```
defp deps do
[
{:electric, ">= 1.0.1"},
{:phoenix_sync, "~> 0.3"},
{:igniter, "~> 0.5", only: [:dev, :test]},
{:phoenix, "~> 1.7.21"},
{:phoenix_ecto, "~> 4.5"},
{:ecto_sql, "~> 3.10"},
{:postgrex, ">= 0.0.0"},
{:phoenix_live_dashboard, "~> 0.8.3"},
{:swoosh, "~> 1.5"},
{:finch, "~> 0.13"},
{:telemetry_metrics, "~> 1.0"},
{:telemetry_poller, "~> 1.0"},
{:gettext, "~> 0.26"},
{:jason, "~> 1.2"},
{:dns_cluster, "~> 0.1.1"},
{:bandit, "~> 1.5"}
]
end
```

I'm trying to use the Phoenix.Sync.Router like this:

```
scope "/shapes" do
pipe_through :sync

sync "/teams", table: "teams" # or sync "/teams", MyApp.Teams.Team
end
```

Results in a compilation error:

```
iex(7)> recompile
Compiling 1 file (.ex)

== Compilation error in file lib/my_app/router.ex ==
** (ArgumentError) No valid table specified. The path {:conn, [line: 1], Plug.Builder} is not a valid table name and no `:table` option passed.
(phoenix_sync 0.3.4) lib/phoenix/sync/router.ex:184: Phoenix.Sync.Router.build_relation/2
(phoenix_sync 0.3.4) lib/phoenix/sync/router.ex:171: Phoenix.Sync.Router.define_shape/3
(phoenix_sync 0.3.4) expanding macro: Phoenix.Sync.Router.sync/2
my_app/lib/my_app_web/router.ex:1: (file)
(phoenix 1.7.21) my_app/lib/my_app_web/router.ex:1: Phoenix.Router.__before_compile__/1
:error
```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.