Closed ellamosi closed 3 years ago
Can confirm the issue. Thanks for the PR. I wish it would get merged to avoid downgrading ecto.
In the meanwhile, if anyone has an urgent need for this, it should be possible to use the fix by replacing your cloak_ecto
dependency in your mix file with: {:cloak_ecto, github: "ellamosi/cloak_ecto", branch: "ecto-3.5.0-support"}
(might need deps unlocking/cleaning). Use this at your own risk, though.
Hey @ellamosi I'm also getting this:
** (UndefinedFunctionError) function Cloak.Ecto.SHA256.equal?/2 is undefined or private
I figured you could probably just update it in your PR before this gets merged
If anyone needs this support without pointing at a different library version, you can include it directly in your types, like so:
defmodule Clove.Ecto.Encrypted do
use Cloak.Ecto.Binary, vault: Clove.Ecto.Vault
def equal?(a, b) do
a == b
end
end
This would not work for the SHA256 type, since that is not macro-based like Binary is.
And the core issue has been resolved in https://github.com/danielberkompas/cloak_ecto/commit/2238af0359a79d145b9e60013afd8aba3478c3ac so I'll be closing this pull request.
Hello, I'm still having the issue. What can I do?
Attempting to upgrade our application to Ecto 3.5.0 (from 3.4.5) we hit a snag in which some Cloak based types would stop working properly when used in changesets with the following exception:
Where that is defined as:
I'm no expert on the internals of Ecto and how Cloak hooks into them, so if this is not right or needs to be different for specific types I'm open to feedback.
For reference, the issue was encountered using Cloak 1.0.2, Cloak_Ecto 1.0.2.