NFIBrokerage / spear

A sharp EventStoreDB v20+ client backed by Mint :yum:
https://hex.pm/packages/spear
Apache License 2.0
85 stars 14 forks source link

Cannot parse :caught_up Response (EventStore 23.10) #94

Closed philipgiuliani closed 7 months ago

philipgiuliani commented 7 months ago

Hi, we've just tried updating from EventStore 21.10 to 23.10 and we are getting the following exception at startup. It might be possible that this issue belongs to https://github.com/fabriziosestito/commanded-spear-adapter but from the stracktrace it seems to belong here.

[error] GenServer Dia.App.Spear.Commanded.EventStore.Adapters.Spear.EventPublisher terminating ** (FunctionClauseError) no function clause matching in Spear.Event.from_read_response/2     (spear 1.3.2) lib/spear/event.ex:355: Spear.Event.from_read_response({:"event_store.client.streams.ReadResp", {:caught_up, {:"event_store.client.streams.ReadResp.CaughtUp"}}}, [json_decoder: #Function<1.23440359/2 in Commanded.EventStore.Adapters.Spear.EventPublisher.handle_info/2>])     (commanded_spear_adapter 0.2.1) lib/commanded/event_store/adapters/spear/event_publisher.ex:54: Commanded.EventStore.Adapters.Spear.EventPublisher.handle_info/2     (stdlib 5.1.1) gen_server.erl:1077: :gen_server.try_handle_info/3     (stdlib 5.1.1) gen_server.erl:1165: :gen_server.handle_msg/6     (stdlib 5.1.1) proc_lib.erl:241: :proc_lib.init_p_do_apply/3
the-mikedavis commented 7 months ago

Yep that's a spear bug, I'll take a look at that soon. It's also failing the CI currently since it uses the latest image. It's introduced on the server side by https://github.com/EventStore/EventStore/commit/80d6546478899cf9bc60606c88a0d2b26cc26e1c#diff-3f4777412535c46201e919412884d13ba6036db276eefe40ba84b8089b0c58f4

the-mikedavis commented 7 months ago

This should be fixed by 22d2bcd7617e603b66658ecbfde418abe41a45cd - the new messages will be sent to the subscriber process as {:caught_up, subscription_ref} and {:fell_behind, subscription_ref}. I'll release those changes once I get a other changes merged in

the-mikedavis commented 7 months ago

This is published to hex as v1.4.0