首页 > 解决方案 > 在凤凰城得到 Absinthe.Blueprint.TypeReference.unwrap 错误?

问题描述

我是 Elixir 和 Phoenix-Framework 的新手,所以我试图制作一个简单的 GraphQL 后端,我们可以在其中添加照片并检索它们,但每当我启动服务器时,我都会收到这个奇怪的错误。 在此处输入图像描述

这是我的 schema.ex 文件:-

defmodule ServerWeb.Schema do
  use Absinthe.Schema
 alias ServerWeb.Resolvers

 import_types __MODULE__.PostsTypes

 query do
  field :photos, list_of(:photo) do
    resolve &Resolvers.Posts.photos/3
  end

end
end

这是我正在使用的解析器

defmodule ServerWeb.Resolvers.Posts do
  alias Server.Posts

  def photos(_, _, _) do
    {:ok, Posts.list_photos}
  end
end

这是我的 PostTypes.ex 文件

defmodule ServerWeb.Schema.PostsTypes do
  use Absinthe.Schema.Notation

  object :photo do
    field :id, non_null(:string)
    field :image_url, non_null(:string)
    field :caption, :string
    field :inserted_at, non null(:string)
    field :updated_at, non_null(:string)
  end

end

谁能帮我解决这个错误?只是为了更多的上下文,这些是我的依赖: -

defp deps do
    [
      {:phoenix, "~> 1.5.8"},
      {:phoenix_ecto, "~> 4.1"},
      {:ecto_sql, "~> 3.4"},
      {:ecto, "~> 3.6"},
      {:postgrex, ">= 0.0.0"},
      {:phoenix_live_dashboard, "~> 0.4"},
      {:telemetry_metrics, "~> 0.4"},
      {:telemetry_poller, "~> 0.4"},
      {:gettext, "~> 0.11"},
      {:jason, "~> 1.0"},
      {:plug_cowboy, "~> 2.0"},
      {:absinthe, "~> 1.6"},
      {:absinthe_plug, "~> 1.5"},
      {:dataloader, "~> 1.0.0"}
    ]
  end

标签: elixirphoenix-frameworkelixir-mix

解决方案


推荐阅读