Hello.
I’m trying to upgrade my app to Ash 3.0 and I’m getting this compile time error:
** (EXIT from #PID<0.98.0>) an exception was raised:
** (KeyError) key :name not found in: {%Ash.Resource.Identity{
name: :unique_username,
keys: [:username],
description: nil,
message: nil,
eager_check?: false,
eager_check_with: nil,
where: nil,
pre_check?: false,
pre_check_with: nil,
all_tenants?: false,
nils_distinct?: true
}, "identity_and_access_management__resources__users_unique_username_index"}
For context, here’s a stripped down version of my User
resource:
defmodule User do
use Ash.Resource,
domain: MyDomain,
data_layer: AshPostgres.DataLayer,
extensions: [AshAuthentication],
authorizers: [Ash.Policy.Authorizer]
attributes do
uuid_primary_key :id
attribute :username, :ci_string, allow_nil?: false, public?: true
attribute :hashed_password, :string, allow_nil?: false, sensitive?: true
end
authentication do
strategies do
password :password do
identity_field :username
end
end
tokens do
enabled? true
token_resource Token
signing_secret fn _, _ ->
Application.fetch_env(:my_app, :token_signing_secret)
end
end
end
postgres do
table "identity_and_access_management__resources__users"
repo MyApp.Repo
end
identities do
identity :unique_username, [:username]
end
end
I don’t know what is wrong and being a compile time error, I’m not sure where to start debugging.
Please, help guide me.