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
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
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
Change your cowboy dependency to {:plug_cowboy, "~> 1.0"}.
Popular in Questions
Other popular topics
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #deployment
- #library
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #channels
- #elixirconf
- #exunit
- #discussion
- #code-sync
- #javascript
- #podcasts
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #elixir-ls
- #phoenix_html
- #iex
- #blog-post
- #graphql
- #genstage
- #ai
- #websockets
- #supervisor
- #advent-of-code
- #elixirconf-us
- #distillery
- #processes
- #forms
- #api
- #metaprogramming
- #security
- #performance









