I’m new to Ash and going through tutorials. In the AshPhoenix walkthrough, after the basic setup I’m getting the following error trying to create the database:
z@Serenity my_ash_phoenix_app % mix ash_postgres.create
** (Mix) Could not load MyAshPhoenixApp.Blog, error: :nofile.
There’s no other info to go on. The referenced walkthrough is: Ash Framework
Wondering if anyone has run into this error and knows what could cause it? I’ve checked the obvious. MyAskPhoenixApp.Blog is declared in my_ash_phoenix_app/blog/blog.ex:
defmodule MyAshPhoenixApp.Blog do
use Ash.Api
resources do
registry MyAshPhoenixApp.Blog.Registry
end
end
Confirmed that the right deps are included, etc… any help would be appreciated.
You bet! Hoping there are no embarrassing typos. It’s the generated config, plus the two lines at the top from the AshPhoenix walkthrough docs. Here you go:
# This file is responsible for configuring your application
# and its dependencies with the aid of the Config module.
#
# This configuration file is loaded before any dependency and
# is restricted to this project.
# General application configuration
import Config
config :my_ash_phoenix_app,
ash_apis: [MyAshPhoenixApp.Blog]
config :my_ash_phoenix_app,
ecto_repos: [MyAshPhoenixApp.Repo],
generators: [timestamp_type: :utc_datetime]
# Configures the endpoint
config :my_ash_phoenix_app, MyAshPhoenixAppWeb.Endpoint,
url: [host: "localhost"],
adapter: Phoenix.Endpoint.Cowboy2Adapter,
render_errors: [
formats: [html: MyAshPhoenixAppWeb.ErrorHTML, json: MyAshPhoenixAppWeb.ErrorJSON],
layout: false
],
pubsub_server: MyAshPhoenixApp.PubSub,
live_view: [signing_salt: "cKy/s3Gh"]
# Configures the mailer
#
# By default it uses the "Local" adapter which stores the emails
# locally. You can see the emails in your browser, at "/dev/mailbox".
#
# For production it's recommended to configure a different adapter
# at the `config/runtime.exs`.
config :my_ash_phoenix_app, MyAshPhoenixApp.Mailer, adapter: Swoosh.Adapters.Local
# Configure esbuild (the version is required)
config :esbuild,
version: "0.17.11",
default: [
args:
~w(js/app.js --bundle --target=es2017 --outdir=../priv/static/assets --external:/fonts/* --external:/images/*),
cd: Path.expand("../assets", __DIR__),
env: %{"NODE_PATH" => Path.expand("../deps", __DIR__)}
]
# Configure tailwind (the version is required)
config :tailwind,
version: "3.3.2",
default: [
args: ~w(
--config=tailwind.config.js
--input=css/app.css
--output=../priv/static/assets/app.css
),
cd: Path.expand("../assets", __DIR__)
]
# Configures Elixir's Logger
config :logger, :console,
format: "$time $metadata[$level] $message\n",
metadata: [:request_id]
# Use Jason for JSON parsing in Phoenix
config :phoenix, :json_library, Jason
# Import environment specific config. This must remain at the bottom
# of this file so it overrides the configuration defined above.
import_config "#{config_env()}.exs"
zac@Serenity blog % pwd
/Users/zac/Projects/Elixir/ash/my_ash_phoenix_app/blog
zac@Serenity blog % ls
./ ../ blog.ex registry.ex resources/
zac@Serenity blog % cat blog.ex
defmodule MyAshPhoenixApp.Blog do
use Ash.Api
resources do
registry MyAshPhoenixApp.Blog.Registry
end
end