Skip to content

Ecto app in umbrella jason error #3263

Closed

Description

@mainlymortal

Environment

  • Elixir version: 1.8
  • Phoenix version: 1.4
  • Operating system: macOS

Expected behavior

mix ecto.migrate runs all pending migrations.

Actual behavior

Error...

18:40:25.636 [info] Application decimal exited: :stopped

18:40:25.638 [info] Application db_connection exited: :stopped

18:40:25.638 [info] Application connection exited: :stopped

18:40:25.639 [info] Application telemetry exited: :stopped
** (MatchError) no match of right hand side value: {:error, {:jason, {'no such file or directory', 'jason.app'}}}
(ecto_sql) lib/mix/ecto_sql.ex:9: Mix.EctoSQL.ensure_started/2
(ecto_sql) lib/mix/tasks/ecto.migrations.ex:43: anonymous fn/3 in Mix.Tasks.Ecto.Migrations.run/3
(elixir) lib/enum.ex:1327: Enum."-map/2-lists^map/1-0-"/2
(ecto_sql) lib/mix/tasks/ecto.migrations.ex:40: Mix.Tasks.Ecto.Migrations.run/3
(mix) lib/mix/task.ex:331: Mix.Task.run_task/3
(mix) lib/mix/cli.ex:79: Mix.CLI.run_task/2

mix ecto.migrations/ecto.reset e.t.c. show the same issue.

Notes

This has been bugging me all day. I created an umbrella phoenix project and 9/10 times when it comes to migrations (and similar mix commands) I get this error. If i delete the _build directory then compile only the ecto app then migrations work. If i compile from the umbrella root or the web app then migrations fail with the above error.

The actual solution seems to be to add {:jason, "~> 1.0"} to the mix deps for the ecto app but in previous versions i've never had to do this.

Activity

  1. josevalim commented on Jan 29, 2019

    @josevalim
    Member

    This is a bug in Elixir but Phoenix should likely consider adding :jason as a dependency to the ecto app too.

  2. josevalim commented on Jan 30, 2019

    @josevalim
    Member

    Fixed on Elixir v1.8.1 but, as said, I would recommend adding jason as a dep in the ecto app too. 👍 Thanks for the report!

  3. mainlymortal commented on Jan 30, 2019

    @mainlymortal
    ContributorAuthor

    Thanks, @josevalim. I just tested it and it does indeed work (not that I ever doubted you haha). So are you suggesting the umbrella templates should be modified to include the jason dependancy by default? If so what is it being used for if the ecto app now works without the dependancy?

  4. josevalim commented on Jan 30, 2019

    @josevalim
    Member

    :D

    @mainlymortal the reason to add jason is because if you want to use a :map field (which requires a JSON lib) then it will already be there. Also, we already include jason in the web app, so it is not like it will make a big difference to have it in both at the end of the day.

  5. added a commit that references this issue on Jan 30, 2019
    48df04c
  6. added a commit that references this issue on Feb 16, 2019
    f127a33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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