You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello! First of all, thank you for an excellent library with commanded and eventstore!
I'm in the process of upgrading an app from commanded 0.19.1 to 1.1.1, and as part of this also upgrading from eventstore 0.17.0 to 1.1.0. I've got to the point where the actual app works fine but I'm having some issues with tests.
The application was already using the jsonb Postgres type for the data and metadata columns on the events table, and I'd like to keep this if possible. I used the JSONB serializer from a gist that you mentioned in issue #185 .
The tests I'm having trouble with are the "Given events / When command / Then assert tests" type for event processors. The Testing your application guide on the commanded wiki mentions the following kind of setup:
When I run my tests, and it gets to the MyApp.EventStore.append_to_stream/3 call, I get an error:
** (DBConnection.EncodeError) Postgrex expected a binary, got %{"foo" => "bar"} Please make sure the value you are passing matches the definition in your table or in your query or convert the value accordingly.
stacktrace:
(postgrex 0.15.5) lib/postgrex/type_module.ex:897: Postgrex.DefaultTypes.encode_params/3
(postgrex 0.15.5) lib/postgrex/query.ex:75: DBConnection.Query.Postgrex.Query.encode/3
(db_connection 2.2.2) lib/db_connection.ex:1148: DBConnection.encode/5
(db_connection 2.2.2) lib/db_connection.ex:1246: DBConnection.run_prepare_execute/5
(db_connection 2.2.2) lib/db_connection.ex:539: DBConnection.parsed_prepare_execute/5
(db_connection 2.2.2) lib/db_connection.ex:532: DBConnection.prepare_execute/4
(postgrex 0.15.5) lib/postgrex.ex:235: Postgrex.query_prepare_execute/4
(eventstore 1.1.0) lib/event_store/storage/appender.ex:147: EventStore.Storage.Appender.insert_event_batch/3
(eventstore 1.1.0) lib/event_store/storage/appender.ex:50: anonymous fn/4 in EventStore.Storage.Appender.append/4
(elixir 1.10.3) lib/enum.ex:789: anonymous fn/3 in Enum.each/2
(elixir 1.10.3) lib/enum.ex:3383: anonymous fn/3 in Enum.each/2
(elixir 1.10.3) lib/stream.ex:1597: anonymous fn/3 in Enumerable.Stream.reduce/3
(elixir 1.10.3) lib/stream.ex:285: Stream.after_chunk_while/2
(elixir 1.10.3) lib/stream.ex:1626: Enumerable.Stream.do_done/2
(elixir 1.10.3) lib/enum.ex:3383: Enum.each/2
(db_connection 2.2.2) lib/db_connection.ex:1427: DBConnection.run_transaction/4
(eventstore 1.1.0) lib/event_store/storage/appender.ex:25: EventStore.Storage.Appender.append/4
In the example above %{"foo" => "bar"} is the event data from the first domain event I'm trying to append.
So it seems that MyApp.EventStore.append_to_stream/3 isn't working properly when the event store is configured to use the JSONB serializer. I was wondering if you have any ideas on how to fix this?
Note: if I switch from the JSONB serializer to the included commanded JSON serializer, this particular test passes. However this causes issues elsewhere, and I'd like my event store setup in tests to match dev & prod.
Thank you for your time!
The text was updated successfully, but these errors were encountered:
During the upgrade I had left out the column_data_type: "jsonb" config option on the event store. This was causing the test DB to be created with wrong column type.
Hello! First of all, thank you for an excellent library with commanded and eventstore!
I'm in the process of upgrading an app from commanded 0.19.1 to 1.1.1, and as part of this also upgrading from eventstore 0.17.0 to 1.1.0. I've got to the point where the actual app works fine but I'm having some issues with tests.
The application was already using the
jsonb
Postgres type for thedata
andmetadata
columns on theevents
table, and I'd like to keep this if possible. I used the JSONB serializer from a gist that you mentioned in issue #185 .The tests I'm having trouble with are the "Given events / When command / Then assert tests" type for event processors. The Testing your application guide on the commanded wiki mentions the following kind of setup:
That seems to be for an older version of commanded / eventstore. I've updated it to:
When I run my tests, and it gets to the
MyApp.EventStore.append_to_stream/3
call, I get an error:In the example above
%{"foo" => "bar"}
is the event data from the first domain event I'm trying to append.So it seems that
MyApp.EventStore.append_to_stream/3
isn't working properly when the event store is configured to use the JSONB serializer. I was wondering if you have any ideas on how to fix this?Note: if I switch from the JSONB serializer to the included commanded JSON serializer, this particular test passes. However this causes issues elsewhere, and I'd like my event store setup in tests to match dev & prod.
Thank you for your time!
The text was updated successfully, but these errors were encountered: