Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix broken reference to app.config in "Creating our own Mix task" docs #5695

Merged
merged 1 commit into from
Jan 15, 2024

Conversation

jyc
Copy link
Contributor

@jyc jyc commented Jan 13, 2024

To use an application's infrastructure, the docs say @requirements ["app.config"] should work, but it doesn’t:

→ mix task.name
Compiling 1 file (.ex)
** (RuntimeError) could not lookup Ecto repo App.Repo because it was not started or it does not exist
    (ecto 3.11.1) lib/ecto/repo/registry.ex:22: Ecto.Repo.Registry.lookup/1
    (ecto 3.11.1) lib/ecto/repo/supervisor.ex:160: Ecto.Repo.Supervisor.tuplet/2
    (app 0.1.0) lib/app/repo.ex:2: App.Repo.all/2
    (app 0.1.0) lib/mix/tasks/task.name.ex:13: Mix.Tasks.App.Ingest.run/1
    (mix 1.16.0) lib/mix/task.ex:478: anonymous fn/3 in Mix.Task.run_task/5
    (mix 1.16.0) lib/mix/cli.ex:96: Mix.CLI.run_task/2
    /Users/jyc/.asdf/installs/elixir/1.16.0-otp-26/bin/mix:2: (file)

I asked on the forums and it turns out that app.start is the correct name: https://elixirforum.com/t/accessing-an-ecto-repo-inside-of-a-mix-task-in-phoenix/60942/2

@chrismccord chrismccord merged commit fb93759 into phoenixframework:main Jan 15, 2024
@chrismccord
Copy link
Member

❤️❤️❤️🐥🔥

@jyc jyc deleted the jyc/fix-app-config-reference branch January 15, 2024 19:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants