Closed mwillema closed 5 years ago
When I want to append some events to the event store using the jsonb encoding, I got the following trace:
** (UndefinedFunctionError) function Jason.encode_to_iodata!/1 is undefined (module Jason is not available) Jason.encode_to_iodata!(%{"brand_uuid" => "MyBrand"}) (postgrex) lib/postgrex/type_module.ex:713: Postgrex.DefaultTypes.encode_params/3 (postgrex) lib/postgrex/query.ex:62: DBConnection.Query.Postgrex.Query.encode/3 (db_connection) lib/db_connection.ex:1088: DBConnection.encode/5 (db_connection) lib/db_connection.ex:1186: DBConnection.run_prepare_execute/5 (db_connection) lib/db_connection.ex:504: DBConnection.parsed_prepare_execute/5 (db_connection) lib/db_connection.ex:497: DBConnection.prepare_execute/4 (postgrex) lib/postgrex.ex:182: Postgrex.query_prepare_execute/4
You need to include the Jason library in mix.exs to use the jsonb data type:
mix.exs
jsonb
defp deps do [{:jason, "~> 1.1"}] end
That will enable the Postgrex types with JSON support.
When I want to append some events to the event store using the jsonb encoding, I got the following trace: