kattair0ta8

kattair0ta8

My app crashes at the start

All of a sudden my app has started to crash:

    $ mix phx.server
    [................]

    Generated my_app app
    [info] Application my_app exited: MyApp.Application.start(:normal, []) returned an error: shutdown: failed to start child: MyAppWeb.Endpoint
        ** (EXIT) shutdown: failed to start child: Phoenix.Endpoint.Handler
            ** (EXIT) an exception was raised:
                ** (UndefinedFunctionError) function Phoenix.Endpoint.Cowboy2Handler.child_spec/3 is undefined (module Phoenix.Endpoint.Cowboy2Handler is not available)
                    Phoenix.Endpoint.Cowboy2Handler.child_spec(:http, MyAppWeb.Endpoint, [port: 4000, otp_app: :my_app])
                    (phoenix) lib/phoenix/endpoint/handler.ex:33: anonymous fn/5 in Phoenix.Endpoint.Handler.init/1
                    (elixir) lib/enum.ex:1925: Enum."-reduce/3-lists^foldl/2-0-"/3
                    (phoenix) lib/phoenix/endpoint/handler.ex:31: Phoenix.Endpoint.Handler.init/1
                    (stdlib) supervisor.erl:295: :supervisor.init/1
                    (stdlib) gen_server.erl:374: :gen_server.init_it/2
                    (stdlib) gen_server.erl:342: :gen_server.init_it/6
                    (stdlib) proc_lib.erl:249: :proc_lib.init_p_do_apply/3
    ** (Mix) Could not start application my_app: MyApp.Application.start(:normal, []) returned an error: shutdown: failed to start child: MyAppWeb.Endpoint
        ** (EXIT) shutdown: failed to start child: Phoenix.Endpoint.Handler
            ** (EXIT) an exception was raised:
                ** (UndefinedFunctionError) function Phoenix.Endpoint.Cowboy2Handler.child_spec/3 is undefined (module Phoenix.Endpoint.Cowboy2Handler is not available)
                    Phoenix.Endpoint.Cowboy2Handler.child_spec(:http, MyAppWeb.Endpoint, [port: 4000, otp_app: :my_app])
                    (phoenix) lib/phoenix/endpoint/handler.ex:33: anonymous fn/5 in Phoenix.Endpoint.Handler.init/1
                    (elixir) lib/enum.ex:1925: Enum."-reduce/3-lists^foldl/2-0-"/3
                    (phoenix) lib/phoenix/endpoint/handler.ex:31: Phoenix.Endpoint.Handler.init/1
                    (stdlib) supervisor.erl:295: :supervisor.init/1
                    (stdlib) gen_server.erl:374: :gen_server.init_it/2
                    (stdlib) gen_server.erl:342: :gen_server.init_it/6
                    (stdlib) proc_lib.erl:249: :proc_lib.init_p_do_apply/3

I’m using and have been using for a while the latest versions of everything: Cowboy - 2.5, Phoenix - 1.3. All has been working fine for over a half a year

Most Liked

cdfuller

cdfuller

The module Plug.Adapters.Cowboy2 was deprecated a few days ago and it’s now recommended to use {:plug_cowboy, "~> 2.0"} for cowboy 2.0

https://hexdocs.pm/plug/Plug.Adapters.Cowboy2.html

I ran into the same or similar problem yesterday and this is how I was able to solve it.

Gazler

Gazler

Phoenix Core Team

Cowboy 2 is only supported on Phoenix 1.4.0-rc.2 and above via {:plug_cowboy, "~> 2.0"}

It is likely that you have updated plug to 1.7 in which case you will be prompted to replace cowboy with {:plug_cowboy, "~> 1.0"} in your mix.exs file.

cdfuller

cdfuller

Change your cowboy dependency to {:plug_cowboy, "~> 1.0"}.

Where Next?

Popular in Questions Top

electic
Hi, I am new to Elixir. I am trying to use the DateTime component to insert a date into MySQL however the there seems to be no way to fo...
New
jononomo
For some reason my phoenix channels are working for me in my local dev environment, but as soon as I deploy via Docker, I get a 403 error...
New
lanycrost
Hi everyone! I need implement if…else if…else condition from my elixir code, and anymore of this control flow structures not work proper...
New
nsuchy
Hi. I’ve noticed that Windows Powershell has it’s own IEX command and you cannot access Elixir’s IEX due to the conflict. This isn’t a cr...
New
Darmani72
If I have a post route which an argument: post /my_post_route/:my_param1, MyController.my_post_handler How would get the post params ...
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
stefanluptak
Hello everybody, usually, I use a 29" ultra-wide monitor for VSCode which can easily accomodate explorer (files panel) + file with code ...
New
freewebwithme
Using vs code and installed ElixirLS: support and debugger. And I got an error popped up on start up says Failed to run ‘elixir’ comma...
New
itssasanka
Hi all, Trying to get some more clarity over utc_datetime and naive_datetime for Ecto: The documentation above suggests that while ...
New
tduccuong
Hi, is there any work on GUI with Elixir, that is similar to Electron/Javascript? My idea is to bundle Phoenix and BEAM into a single se...
New

Other popular topics Top

RisingFromAshes
I’ve read in another post that it may be possible with a router helper - but I couldn’t find an appropriate one, and tbh, I’m still just ...
New
vertexbuffer
Hello, can anybody help here..? I have a list of players and I what to delete an element, but every for loop the list is reverting to ori...
New
hariharasudhan94
Lets say I have map like this fetching from my database %{"_id" => #BSON.ObjectId<58eb1a7a9ad169198c3dXXXX>, "email" => ...
New
aadeshere1
I have a another noob question about loop. Since elixir is immutable, while loop is not directly possible. total = 10 while total != 0 ...
New
gshaw
What is the idiomatic way of matching for not nil in Elixir? E.g., First way: defp halt_if_not_signed_in(conn, signed_in_account) when...
New
sen
Hi All, I set a environment variables in dev.exs , like below code. when i start server, how can i set the ${enable} value? thanks. d...
New
bsollish-terakeet
Credo is smart enough to check for (something like) this: assert length(the_list) == 0 with this response: Checking if an enum is empt...
New
shijith.k
I am trying to start a new phoenix project with elixir 1.9, but mix phx.new does not work. It says that ** (Mix) The task "phx.new" could...
New
WestKeys
Currently suffering from paralysis by [HTTP client] analysis. This is rather unusual in Elixirland as there tends to be consensus on the ...
New
sergio
Kind of like when jquery came out, it was super necessary. Existing drag and drop libraries have a bunch of baggage to support old browse...
New

Latest on Elixir Forum

Elixir Forum

We're in Beta

About us Mission Statement