Skip to content

Latest Ecto breaks. #4

@hickscorp

Description

@hickscorp

EctoPoly used to work with Ecto 3.5.0 / 3.5.1, but it doesn't anymore with 3.5.

I think EctoPoly calls Ecto.Type.dump/3 with a funky value such as {:embed, %Ecto.Embedded{...}} that isn't matched anymore in Ecto.Type.dump/3. The call stack looks like this:

  4) test approve_onboard/1 creates a matching role (TTAPI.OnboardingTest)
     apps/tt_api/test/tt_api/onboarding_test.exs:378
     ** (FunctionClauseError) no function clause matching in Ecto.Type.dump/3

     The following arguments were given to Ecto.Type.dump/3:
     
         # 1
         {:embed, %Ecto.Embedded{cardinality: :one, field: :data, on_cast: nil, on_replace: :raise, ordered: true, owner: nil, related: TTCore.Profile.Organisation, unique: true}}
     
         # 2
         %TTCore.Profile.Organisation{avatar: nil, description: nil, id: nil, name: "BackRub Inc."}
     
         # 3
         &EctoPoly.dump_value/2
     
     Attempted function clauses (showing 10 out of 26):
     
         def dump({:parameterized, module, params}, value, dumper)
         def dump(_type, nil, _dumper)
         def dump({:maybe, type}, value, dumper)
         def dump({:in, type}, value, dumper)
         def dump({:array, type}, value, dumper)
         def dump({:map, type}, value, dumper)
         def dump({:parameterized, mod, params}, value, dumper)
         def dump(:any, value, _dumper)
         def dump(:integer, value, _dumper)
         def dump(:float, value, _dumper)
         ...
         (16 clauses not shown)
     
     code: |> Onboarding.approve_onboard()
     stacktrace:
       (ecto 3.5.2) Ecto.Type.dump/3
       (tt_core 0.1.0) lib/tt_core/profile.ex:11: TTCore.Profile.dump/1
       (ecto 3.5.2) lib/ecto/type.ex:892: Ecto.Type.process_dumpers/3
       (ecto 3.5.2) lib/ecto/repo/schema.ex:885: Ecto.Repo.Schema.dump_field!/6
       (ecto 3.5.2) lib/ecto/repo/schema.ex:898: anonymous fn/6 in Ecto.Repo.Schema.dump_fields!/5
       (stdlib 3.12) maps.erl:232: :maps.fold_1/3
       (ecto 3.5.2) lib/ecto/repo/schema.ex:896: Ecto.Repo.Schema.dump_fields!/5
       (ecto 3.5.2) lib/ecto/repo/schema.ex:829: Ecto.Repo.Schema.dump_changes!/6
       (ecto 3.5.2) lib/ecto/repo/schema.ex:255: anonymous fn/15 in Ecto.Repo.Schema.do_insert/4
       (ecto 3.5.2) lib/ecto/multi.ex:646: Ecto.Multi.apply_operation/5
       (elixir 1.10.4) lib/enum.ex:2111: Enum."-reduce/3-lists^foldl/2-0-"/3
       (ecto 3.5.2) lib/ecto/multi.ex:630: anonymous fn/5 in Ecto.Multi.apply_operations/5
       (ecto_sql 3.5.1) lib/ecto/adapters/sql.ex:1027: anonymous fn/3 in Ecto.Adapters.SQL.checkout_or_transaction/4
       (db_connection 2.3.0) lib/db_connection.ex:1426: DBConnection.run_transaction/4
       (ecto 3.5.2) lib/ecto/repo/transaction.ex:20: Ecto.Repo.Transaction.transaction/4
       test/tt_api/onboarding_test.exs:382: (test)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions