-
Notifications
You must be signed in to change notification settings - Fork 11
Open
Description
Hi there, I was experimenting with embedded Electric and Phoenix Sync today and noticed that upgrading to 0.6.1 triggered a new error in my sync/2 routes.
I'm assuming this is related to the new Code.ensure_loaded? condition added here:
phoenix_sync/lib/phoenix/sync/electric.ex
Line 644 in aaeaef7
| Code.ensure_loaded?(Phoenix.Sync.Electric.ApiAdapter) do |
Here's the error:
[error] ** (Protocol.UndefinedError) protocol Phoenix.Sync.Adapter.PlugApi not implemented for Electric.Shapes.Api (a struct). This protocol is implemented for: Phoenix.Sync.Electric.ApiAdapter, Phoenix.Sync.Electric.ClientAdapter, Phoenix.Sync.Sandbox.APIAdapter
Got value:
%Electric.Shapes.Api{
inspector: {Electric.Postgres.Inspector.EtsInspector,
[
stack_id: "electric-embedded",
server: {:via, Registry,
{:"Electric.ProcessRegistry:electric-embedded",
{Electric.Postgres.Inspector.EtsInspector, nil}}}
]},
pg_id: nil,
registry: :"Registry.ShapeChanges:electric-embedded",
persistent_kv: %Electric.PersistentKV.Filesystem{
root: "/var/folders/tw/32phbqjx24qbnnfqnm9zzg3h0000gn/T/phoenix-sync-576460751600180209"
},
shape: nil,
shape_cache: {Electric.ShapeCache,
[
stack_id: "electric-embedded",
server: {:via, Registry,
{:"Electric.ProcessRegistry:electric-embedded",
{Electric.ShapeCache, nil}}}
]},
stack_events_registry: Electric.StackEventsRegistry,
stack_id: "electric-embedded",
storage: {Electric.ShapeCache.PureFileStorage,
%{
tmp_dir: "/var/folders/tw/32phbqjx24qbnnfqnm9zzg3h0000gn/T/phoenix-sync-576460751600180209/electric-embedded/.tmp/electric-embedded",
base_path: "/var/folders/tw/32phbqjx24qbnnfqnm9zzg3h0000gn/T/phoenix-sync-576460751600180209/electric-embedded",
chunk_bytes_threshold: 10485760,
stack_id: "electric-embedded",
stack_ets: :"Elixir.Electric.ShapeCache.PureFileStorage:electric-embedded",
stack_task_supervisor: {:via, Registry,
{:"Electric.ProcessRegistry:electric-embedded",
{Electric.ShapeCache.PureFileStorage.TaskSupervisor, nil}}},
flush_period: 1000,
compaction_config: %{period: 600000, keep_complete_chunks: 2}
}},
feature_flags: [],
allow_shape_deletion: false,
keepalive_interval: 21000,
long_poll_timeout: 20000,
sse_timeout: 60000,
max_age: 60,
stack_ready_timeout: 5000,
stale_age: 300,
send_cache_headers?: false,
encoder: Electric.Shapes.Api.Encoder.JSON,
sse_encoder: Electric.Shapes.Api.Encoder.SSE,
configured: true
}
(phoenix_sync 0.6.1) lib/phoenix/sync/adapter/plug_api.ex:1: Phoenix.Sync.Adapter.PlugApi.impl_for!/1
(phoenix_sync 0.6.1) lib/phoenix/sync/adapter/plug_api.ex:7: Phoenix.Sync.Adapter.PlugApi.predefined_shape/2
(phoenix_sync 0.6.1) lib/phoenix/sync/electric.ex:578: Phoenix.Sync.Electric.api_predefined_shape/4
(phoenix 1.8.1) lib/phoenix/router.ex:416: Phoenix.Router.__call__/5
(kaimono 0.1.0) lib/kaimono_web/endpoint.ex:1: KaimonoWeb.Endpoint.plug_builder_call/2
(kaimono 0.1.0) deps/plug/lib/plug/debugger.ex:155: KaimonoWeb.Endpoint."call (overridable 3)"/2
(kaimono 0.1.0) lib/kaimono_web/endpoint.ex:1: KaimonoWeb.Endpoint.call/2
(phoenix 1.8.1) lib/phoenix/endpoint/sync_code_reload_plug.ex:22: Phoenix.Endpoint.SyncCodeReloadPlug.do_call/4
(bandit 1.8.0) lib/bandit/pipeline.ex:131: Bandit.Pipeline.call_plug!/2
(bandit 1.8.0) lib/bandit/pipeline.ex:42: Bandit.Pipeline.run/5
(bandit 1.8.0) lib/bandit/http1/handler.ex:13: Bandit.HTTP1.Handler.handle_data/3
(bandit 1.8.0) lib/bandit/delegating_handler.ex:18: Bandit.DelegatingHandler.handle_data/3
(bandit 1.8.0) lib/bandit/delegating_handler.ex:8: Bandit.DelegatingHandler.handle_continue/2
(stdlib 7.1) gen_server.erl:2424: :gen_server.try_handle_continue/3
(stdlib 7.1) gen_server.erl:2291: :gen_server.loop/4
(stdlib 7.1) proc_lib.erl:333: :proc_lib.init_p_do_apply/3Metadata
Metadata
Assignees
Labels
No labels