No such resource MyDomain.EmbeddedResource1

I get the following error…

** (Ash.Error.Invalid) Invalid Error

* No such resource MyDomain.EmbeddedResource1

when running the folling code.

EmbeddedResource1
          |> Ash.Query.filter(list_id == ^old_list_id)
          |> Ash.DataLayer.Simple.set_data(socket.assigns.lists.result)
          |> Ash.read!(domain: MyDomain)
          |> Enum.at(0)

Here is the defmodule for this embedded resource.

defmodule MyDomain.EmbeddedResource1 do
  use Ash.Resource,
    data_layer: :embedded,
    notifiers: [
      Ash.Notifier.PubSub
    ]

It appears that Ash looks for this resource in MyDomain, but doesn’t find it there because embedded resources are not supposed to be listed in the domain’s resource list.

How do I fix the above error?

Hadn’t really considered this use case. You can use the domain that we use for interacting with embeds: Ash.EmbeddableType.ShadowDomain. Should probably make it so that all domains work with embedded resources…