Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

0.6.0 -> 0.6.1: protocol Phoenix.Sync.Adapter.PlugApi not implemented for Electric.Shapes.Api

Aperta
#117 5 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
3/5
Tempo stimato
1-2 giorni
Idoneità per principianti
45/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Tranquilla
Stack tecnologico
elixir
Ambito
api, backend

Direzione di ricerca

Inizia in lib/phoenix/sync/electric.ex, intorno alla condizione Code.ensure_loaded? alla riga 644, quindi segui sync/2 attraverso api_predefined_shape/4 e Phoenix.Sync.Adapter.PlugApi.predefined_shape/2. Riproduci il fallimento di Electric.Shapes.Api incorporato e determina il comportamento previsto dell’adapter; il lavoro è completato quando la route sync/2 gestisce quell’API senza Protocol.UndefinedError.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

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:
https://github.com/electric-sql/phoenix_sync/blob/aaeaef7842a40e937c616504e61fb568fd28efc4/lib/phoenix/sync/electric.ex#L644

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/3
Lingua principale
Elixir
Stelle
290
Fork
17
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Guida per i contributori

Nessuna guida per i contributori indicizzata per questo repository

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di electric-sql/phoenix_sync

Tutte le issue di electric-sql/phoenix_sync

Issue simili

Altre issue su Elixir

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.