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

Ecto app in umbrella jason error #3263

Closed
mainlymortal opened this issue Jan 28, 2019 · 4 comments
Closed

Ecto app in umbrella jason error #3263

mainlymortal opened this issue Jan 28, 2019 · 4 comments

Comments

@mainlymortal
Copy link
Contributor

mainlymortal commented Jan 28, 2019

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.

@josevalim
Copy link
Member

josevalim commented Jan 29, 2019

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

@josevalim
Copy link
Member

josevalim commented Jan 30, 2019

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!

@mainlymortal
Copy link
Contributor Author

mainlymortal commented Jan 30, 2019

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?

@josevalim
Copy link
Member

josevalim commented Jan 30, 2019

: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.

Xiaobin0860 added a commit to Xiaobin0860/phoenix that referenced this issue Feb 16, 2019
* phx/master: (26 commits)
  Support any struct with :endpoint key in helpers
  Inspect body in ConnTest.response/2 (phoenixframework#3267)
  update snippet to agree with latest phx.new (phoenixframework#3277)
  Only enable trim for HTML templates
  Revert reconnect optimizations which introduced regressions. Fixes phoenixframework#3161 (phoenixframework#3272)
  Reword sentence in Controllers guide (phoenixframework#3270)
  update documentation to reflect on function deprecations (phoenixframework#3269)
  Fix warning in presence
  Default log for render errors info should be debug
  Add jason to umbrella ecto deps. Fixes phoenixframework#3263
  Add Elixir Slack community in the help column of the initial default page (phoenixframework#3262)
  Update heroku.md (phoenixframework#3241)
  add JavaPhoenixClient in 3rd party channels client libraries list (phoenixframework#3256)
  fix typespec for put_layout (phoenixframework#3253)
  Add version to umbrellas (mirror Elixir master)
  Fix references in guides (phoenixframework#3251)
  Add $PORT bind step in Heroku deployment guide (phoenixframework#3235)
  update link to mime  types (phoenixframework#3249)
  Add Elixir 1.7 and 1.8 to Travis CI build matrix (phoenixframework#3248)
  Update learning.md (phoenixframework#3247)
  ...
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

No branches or pull requests

2 participants