MeAndMark
I am starting a project with Ash and Phoenix. I take the general steps shown in the Get Started with Ash and Phoenix tutorial on the Ash documentation website. I create an Ash domain and resources. I set up the repo for the project. I add the Ash domains to the config.exs file.
config :forum_app,
ash_domains: [ForumApp.Forum],
ecto_repos: [ForumApp.Repo],
generators: [timestamp_type: :utc_datetime]
When I run the mix ash.codegen command to create the initial database migration. I get the following error message in the Terminal:
(UndefinedFunctionError) function ForumApp.Forum.config/0 is undefined or private
(forum_app 0.1.0) ForumApp.Forum.config()
(ash_postgres 2.4.12) lib/migration_generator/migration_generator.ex:160: AshPostgres.MigrationGenerator.snapshot_path/2
(ash_postgres 2.4.12) lib/migration_generator/migration_generator.ex:168: anonymous fn/2 in AshPostgres.MigrationGenerator.create_extension_migrations/2
(elixir 1.17.2) lib/enum.ex:1703: Enum."-map/2-lists^map/1-1-"/2
(elixir 1.17.2) lib/enum.ex:1703: Enum."-map/2-lists^map/1-1-"/2
(ash_postgres 2.4.12) lib/migration_generator/migration_generator.ex:53: AshPostgres.MigrationGenerator.generate/2
(mix 1.17.2) lib/mix/task.ex:495: anonymous fn/3 in Mix.Task.run_task/5
(elixir 1.17.2) lib/enum.ex:1703: Enum."-map/2-lists^map/1-1-"/2
The database tables for my Ash resources are not created because of this error.
I have been able to create migrations in other Ash projects so I have made a mistake somewhere. But when I look at the code from the new project and compare it with similar code from other projects, I’m not seeing where my mistake is.
Where is the config function created for an Ash domain? Where should I be looking to fix this compiler error?
Trending in Questions
Other Trending Topics
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #deployment
- #library
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #channels
- #elixirconf
- #exunit
- #discussion
- #code-sync
- #javascript
- #podcasts
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #elixir-ls
- #blog-post
- #phoenix_html
- #iex
- #graphql
- #ai
- #genstage
- #elixirconf-us
- #websockets
- #supervisor
- #advent-of-code
- #distillery
- #processes
- #api
- #forms
- #metaprogramming
- #security
- #hex










Showing Posts 1 to 7- Show Best Posts
- Show All Posts (oldest first)
- Show All Posts (newest first)
barnabasJ
Looking at this line of code. It should actually look for the config on the Repo module.
What does your
postgressection on the resource look like?MeAndMark
Here’s the code for the
postgressection on the resource.And here’s the code for the Repo.
barnabasJ
I’m not sure why it would try to use the domain in that case. Can you double check you did it exactly like in the example.
Otherwise, you can try to use igniter to bootstrap a project.
That also adds mix tasks to generate resources.
MeAndMark
I used igniter to create the project. I used the following commands:
And I added the AshPhoenix and AshPostgres dependencies in the
mix.exsfile.barnabasJ
Yeah, not sure TBH. If you push the code to Github, I can take a look if you want
MeAndMark
Here’s the link to the GitHub repo for the project.
https://github.com/meandmark/ForumApp
MeAndMark
I figured out what the problem was. It was in the
postgressection of one of my other resources. I had the name of the domain as the repo instead of the name of the repo.Problem code:
Fixed code:
Thanks for the help. You were on correct about the
postgressection being the problem.