Help with pow_assent under umbrella. protocol Ecto.Queryable not implemented for Simple.UserIdentity of type Atom

Anyone with experience can shed some light why I’m getting this error when trying Oauth with google.

When google hits the callback endpoint it breaks with the error:

# protocol Ecto.Queryable not implemented for Simple.UserIdentity of type Atom, the given module does not exist. This protocol is implemented for the following type(s): Ecto.Query, Atom, BitString, Tuple, Ecto.SubQuery

my umbrella app consists of two apps simple(ecto) and simple_web(phoenix).
I was able to get the pow library working under the umbrella but trying to implement pow_assent has been an uphill journey for me as I’m very new to elixir/phoenix.

The only reference I could find about an umbrella app and pow_assent is this:

The creator of the library mentions two phoenix apps, I am using just one because I don’t want the oaut provider yet.

contents of what(I think) are important files for this:

apps/simple/lib/simple/user_identities/user_identity.ex

defmodule Simple.UserIdentities.UserIdentity do
  use Ecto.Schema
  use PowAssent.Ecto.UserIdentities.Schema, user: Simple.Users.User

  schema "user_identities" do
    pow_assent_user_identity_fields()

    timestamps()
  end
end

apps/simple/lib/simple/users/user.ex

defmodule Simple.Users.User do
  use Ecto.Schema
  use Pow.Ecto.Schema
  use PowAssent.Ecto.Schema
  use Pow.Extension.Ecto.Schema,
    extensions: [PowResetPassword, PowEmailConfirmation]

  schema "users" do
    has_many :user_identities,
    Simple.UserIdentity,
      on_delete: :delete_all,
      foreign_key: :user_id
    pow_user_fields()

    timestamps()
  end

  def changeset(user_or_changeset, attrs) do
    user_or_changeset
    |> pow_changeset(attrs)
    |> pow_extension_changeset(attrs)
  end
end

config.exs

config :simple, :pow_assent,
  providers: [
    google: [
      client_id: "redacted",
      client_secret: "redacted",
      strategy: Assent.Strategy.Google
    ]
  ]

Any pointers would be really appreciated, I apologize if this seems rather basic, I’m very new to this ecosystem.

(doh) The problem was here. it needed to be changed to:

Simple.UserIdentity do

I will never get used of how useful errors are in this language and framework.

1 Like