Skip to content

mix igniter.install phoenix_sync --sync-mode embedded fails on first run but succeeds on second run #126

@spapiernik

Description

@spapiernik

Environment

  • Elixir: 1.20.0-rc.4-otp-28, 1.19.5-otp-28, 1.18.4-otp-28
  • Phoenix: 1.7.x
  • Phoenix.Sync: 0.6.1
  • igniter: 0.7.7

What I did

  1. Created a new project:
mix phx.new hello
  1. Added igniter to mix.exs:
{:igniter, "~> 0.6", only: [:dev, :test]}
  1. Then ran:
mix igniter.install phoenix_sync --sync-mode embedded

First run result (FAILS)

Igniter adds phoenix_sync to mix.exs and compiles it, but then crashes with:

** (UndefinedFunctionError) function Phoenix.Sync.MixProject.project/0 is undefined (module Phoenix.Sync.MixProject is not available)
    Phoenix.Sync.MixProject.project()
    (phoenix_sync 0.6.1) lib/mix/tasks/phoenix_sync.install.ex:301: Mix.Tasks.PhoenixSync.Install.required_electric_version/0
    (phoenix_sync 0.6.1) lib/mix/tasks/phoenix_sync.install.ex:123: Mix.Tasks.PhoenixSync.Install.add_dependencies/2
    (igniter 0.7.7) lib/igniter/util/install.ex:187: anonymous fn/3 in Igniter.Util.Install.run_installers/5
    (elixir 1.20.0-rc.4) lib/enum.ex:2617: Enum."-reduce/3-lists^foldl/2-0-"/3
    (igniter 0.7.7) lib/igniter/util/install.ex:176: Igniter.Util.Install.run_installers/5
    (mix 1.20.0-rc.4) lib/mix/task.ex:502: anonymous fn/3 in Mix.Task.run_task/5
    (mix 1.20.0-rc.4) lib/mix/cli.ex:129: Mix.CLI.run_task/2

At this point:

  • phoenix_sync has already been added to deps
  • but the installer crashes before finishing

Second run (WORKS)

Without changing anything else, I run:

mix igniter.install phoenix_sync --sync-mode embedded

Now it succeeds:

  • Detects phoenix_sync already installed
  • Adds :electric
  • Runs phoenix_sync.install
  • Updates config and application files correctly

Observed behavior

What I expected

  • mix igniter.install phoenix_sync --sync-mode embedded to succeed on the first run

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions