henriquefernandez

henriquefernandez

Can't compile "cowboy" in a bare new phoenix project

Elixir / OTP version:

$ elixir -v
Erlang/OTP 21 [erts-10.0] [source] [smp:4:4] [ds:4:4:10] [async-threads:1] [hipe]

Elixir 1.10.3 (compiled with Erlang/OTP 21)

Phoenix version:

$ mix phx.new --version
Phoenix v1.5.0

Trying to create a database (after mix phx.new name --no-webpack):

$ mix ecto.create
===> Compiling cowboy
Function: request_process/3
===> Compiling src/cowboy_stream_h.erl failed
src/cowboy_stream_h.erl:none: internal error in sys_core_dsetel;
crash reason: {case_clause,
    {'EXIT',
        {{case_clause,
             #{0 => 1,1 => 1,2 => 1,4 => 1,5 => 1,6 => 1,10 => 0,
               'Reason' => 1}},
         [{sys_core_dsetel,visit,2,[{file,"sys_core_dsetel.erl"},{line,98}]},
          {lists,mapfoldl,3,[{file,"lists.erl"},{line,1354}]},
          {lists,mapfoldl,3,[{file,"lists.erl"},{line,1355}]},
          {sys_core_dsetel,visit,2,[{file,"sys_core_dsetel.erl"},{line,188}]},
          {lists,mapfoldl,3,[{file,"lists.erl"},{line,1354}]},
          {lists,mapfoldl,3,[{file,"lists.erl"},{line,1355}]},
          {sys_core_dsetel,visit,2,[{file,"sys_core_dsetel.erl"},{line,188}]},
          {sys_core_dsetel,visit,2,
              [{file,"sys_core_dsetel.erl"},{line,144}]}]}}}

  in function  compile:'-select_passes/2-anonymous-2-'/3 (compile.erl, line 585)
  in call from compile:'-internal_comp/5-anonymous-1-'/3 (compile.erl, line 349)
  in call from compile:fold_comp/4 (compile.erl, line 376)
  in call from compile:internal_comp/5 (compile.erl, line 360)
  in call from compile:'-do_compile/2-anonymous-0-'/2 (compile.erl, line 177)
  in call from compile:'-do_compile/2-anonymous-1-'/1 (compile.erl, line 190)

** (Mix) Could not compile dependency :cowboy, "/home/henrique/.asdf/installs/elixir/1.10.3-otp-21/.mix/rebar3 bare compile --paths="/home/henrique/Desktop/Project
s/materic/materic_demo/_build/dev/lib/*/ebin"" command failed. You can recompile this dependency with "mix deps.compile cowboy", update it with "mix deps.update co
wboy" or clean it with "mix deps.clean cowboy"

When i execute the command with rebar:

$ /home/henrique/.asdf/installs/elixir/1.10.3-otp-21/.mix/rebar3 bare compile --paths="/home/henrique/Desktop/Projects/materic/demo/_build/dev/lib/*/ebin"
===> Uncaught error in rebar_core. Run with DEBUG=1 to see stacktrace or consult rebar3.crashdump
===> When submitting a bug report, please include the output of `rebar3 report "your command"`

With DEBUG=1:

$ DEBUG=1 /home/henrique/.asdf/installs/elixir/1.10.3-otp-21/.mix/rebar3 bare compile --
paths="/home/henrique/Desktop/Projects/materic/demo/_build/dev/lib/*/ebin"
===> Expanded command sequence to be run: []
===> Provider: {default,do}
===> Expanded command sequence to be run: [{default,app_discovery},
                                                  {bare,compile}]
===> Provider: {default,app_discovery}
===> Provider: {bare,compile}
===> Uncaught error in rebar_core. Run with DEBUG=1 to see stacktrace or consult rebar3.crashdump
===> Uncaught error: {badmatch,[]}
===> Stack trace to the error location:
[{rebar_prv_bare_compile,do,1,
                         [{file,"/tmp/cirrus-ci-build/src/rebar_prv_bare_compile.erl"},
                          {line,60}]},
 {rebar_core,do,2,
             [{file,"/tmp/cirrus-ci-build/src/rebar_core.erl"},{line,154}]},
 {rebar_prv_do,do_task,5,
               [{file,"/tmp/cirrus-ci-build/src/rebar_prv_do.erl"},{line,87}]},
 {rebar_core,do,2,
             [{file,"/tmp/cirrus-ci-build/src/rebar_core.erl"},{line,154}]},
 {rebar3,run_aux,2,[{file,"/tmp/cirrus-ci-build/src/rebar3.erl"},{line,182}]},
 {rebar3,main,1,[{file,"/tmp/cirrus-ci-build/src/rebar3.erl"},{line,66}]},
 {escript,run,2,[{file,"escript.erl"},{line,758}]},
 {escript,start,1,[{file,"escript.erl"},{line,277}]}]
===> When submitting a bug report, please include the output of `rebar3 report "your command"`

Some interesting things:

  • I also tried mix local.rebar --force and mix local.rebar and got the same error.
  • It creates the database in other existent phoenix projects in the same machine using mix ecto.create.
  • I also tried to remove / purge and reinstall both Erlang, Elixir and Phoenix.
  • I also tried to install others phx_new versions / archives.
  • The OS is an Ubuntu 16 / 32bits.
  • It happened “out of the blue”.
  • Of course other mix tasks aren’t working. But only in new phoenix projects.

Marked As Solved

tangui

tangui

Cowboy 2.8.0 was released yesterday on hex.pm and requires OTP22+.

Two possible solutions:

  • upgrade to OTP22
  • set Cowboy version in mix.exs (something like {:cowboy, "< 2.8.0", override: true} in the deps section but haven’t tested)
11
Post #3

Also Liked

spencerdcarlson

spencerdcarlson

Should this be address in phoenix? It seems like phoenix should protect itself from another dependency pulling in an incompatible version of cowboy (2.8.0).

This would save us from having to explicitly declare the correct cowboy version in our mix.exs file. When we really don’t care about what version of cowboy we are using.

I ran into the same issue when running a mix deps.update new_relic_agent resulted in new_relic_agent 1.18.0 => 1.18.4 which caused my cowboy to be updated from 2.6.3 to 2.8.0, cowboy 2.8.0 is pulling in cowlib 2.9.1 which is the actual root of the issue, because cowlib 2.9.1 will not compile with phoenix.

Or is this a cowboy issue that 2.8.0 should have been a major bump?

Also, I would argue that the correct fix for this, at least in my situation would be to add

{:cowlib, "~> 2.8.0"}

to deps in your mix.exs file. This is the bare minimum requirement

axelson

axelson

Scenic Core Team

Do you still get the error if you use the 1.5.3 version of phx.new (mix archive.install hex phx_new 1.5.3)?

What version of cowboy is being used (mix deps)? I don’t think cowboy 2.8 is supported yet.

Do you still get the error with a plain mix compile?

henriquefernandez

henriquefernandez

Thank you @axelson @tangui

cowboy 2.8 is not supported in this OTP version

:grinning:

edupiorini

edupiorini

saved my life!

Where Next?

Popular in Questions Top

dotdotdotPaul
Okay, I'm having a heck of a time trying to figure out how to best handle the validation of belongs_to associations in Ecto. I'm sure I'...
New
LegitStack
I’m hoping you guys can give me some general advice and perhaps code examples if you’re feeling up to it. I’m very interested in Elixir,...
New
New
dokuzbir
Hello, I am trying to convert my lists to string without losing brackets.For start i have 3 map. They look like these buyer = %{ id: ...
New
vac
Hi, I'm quite new in Elixir and I'm trying to format a string to a PEM format. I have the certificate value like MIIDBTCCAe2...... and ...
New
chensan
I have a User schema with a :from_id field set to type :string: defmodule TweetBot.Repo.Migrations.CreateUsers do use Ecto.Migration ...
New
rms.mrcs
Hi, I need to transform a list of numbers into a map where the keys are the indexes and the values are the original values of the list....
New
Patoshizzle
After calling mix ecto.create I get this error: 17:00:32.162 [error] GenServer #PID&lt;0.412.0&gt; terminating ** (Postgrex.Error) FATAL...
New
romenigld
I am trying to run a deploy with docker and I successfully runned with this command: docker build -t romenigld/blog-prod . but when I t...
New
vrod
I am using the Starship cross-shell prompt – it seems pretty nice, but I get some errors: [WARN] - (starship::utils): Executing command ...
New

Other popular topics Top

lessless
I believe there are people here who are dealing with CSV files import on the daily basis, and since Excel is a really popular tool there ...
New
sergio_101
I am VERY much an elixir newbie. I have taken one elixir course and one phoenix course on Udemy. During that course, I saw the instructor...
New
_russellb
I want to try my hand at web scraping. What tools/libraries do I need to use. I’m hoping to turn this into something professional so don’...
New
New
script
If I have a string “1000 cfu/ml” . I want to remove the characters and / and space . So the string is like this "1000" What is the ...
New
shahryarjb
Hello, I have map which I want to convert it to string like this: the map: %{last_name: "tavakkoli", name: "shahryar"} the string I ne...
New
vonH
When I run the Plug and I recompile I wind up having to use Ctrl C to quit iex and start again. Witht the help of rlwrap I can use the cu...
New
chrisalley
ExUnit now has describe blocks which is a welcome addition coming from RSpec. In the docs, it states that nested hierarchies of describe ...
New
Fl4m3Ph03n1x
About me? ( if you have nothing better to do than reading about some random guy in the internet :stuck_out_tongue: ) Hello all, this is ...
New
siddhant3030
Hi, I have to write a raw query for one of my project. But till now I have used ecto queries and don’t have much experience writing raw ...
New

We're in Beta

About us Mission Statement