kattair0ta8

kattair0ta8

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

Showing Posts 1 to 10

OvermindDL1

OvermindDL1

Well this is definitely the issue. Cowboy2 handler means that something was updated very recently and not everything was updated entirely and properly and/or _build got corrupted, in which case wipe and rebuild?

kattair0ta8

kattair0ta8 OP

removed _build and recompiled – didn’t help

cdfuller

cdfuller

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

OvermindDL1

OvermindDL1

They said they were already using cowboy2 successfully so that shouldn’t be needed.

Can you post your mix.exs file so I can drop it into a new project to give it a try?

kattair0ta8

kattair0ta8 OP

  defp deps do
    [
      
      {:phoenix, github: "phoenixframework/phoenix", override: true},
      # {:phoenix, github: "phoenixframework/phoenix"},
      # {:phoenix, "~> 1.3.4"},


      {:phoenix_pubsub, "~> 1.1"},
      {:phoenix_ecto, "~> 3.5"},
      {:postgrex, "~> 0.13.5"},
      {:phoenix_html, "~> 2.12"},
      {:phoenix_live_reload, "~> 1.1", only: :dev},
      {:gettext, "~> 0.16"},
      {:cowboy, "~> 2.5", override: true},
      {:yamerl, "~> 0.7"},
      {:earmark, "~> 1.2"},
      {:edeliver, "~> 1.6"},
      {:distillery, "~> 2.0"},
      {:httpoison, "~> 1.4"},
      {:swoosh, "~> 0.20"},
      {:gen_smtp, "~> 0.13"},


      # {:poison, "~> 4.0.1"},
      # {:poison, "~> 4.0.1", override: true},
      {:poison, "~> 3.1"},
    ]
  end
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.

kattair0ta8

kattair0ta8 OP

Why and how did it use to work without plug_cowboy at all in my project?

phoenix 1.3.4 of August 2018 - doesn’t work now either

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.

kattair0ta8

kattair0ta8 OP

I know where it’s suppoted.

Look at my mix, it’s been working since a half a year ago.

kattair0ta8

kattair0ta8 OP

…How?

Where Next? Top

Trending in Questions Top

RSP87
I’m working on a project that simulates the bumbl example in the programming phoenix book. It acts almost like an email client. We have a...
New
nseaSeb
Hello, I know there is an approach for handling lists that allows for optimized traversal, but I can’t recall the specific method (somet...
New
brecabral
Documentation While reading the Scoped Routes section, I noticed that the documentation currently refers to a problem without explainin...
New
RemyXRenard
I’m seeing that a list inside a Kino.DataTable will be interpreted as a charlist, even if the Kino.configure() is set to charlists: :as_l...
New
velrest
So my question is quite simple and i have found no conclusive answer on forum, google or AI. Should we use :erlang.float for Integer to ...
New
samoloth
Hi, I’ve just set up an application with ash_authentication. There is only magic link strategy for now, so there is no confirmation add o...
New
FlyingNoodle
If a change or preparation module uses Ash.Changeset.get_argument/2 or Ash.Query.get_argument/2 (or any of the other get_argument functio...
New

Other Trending Topics Top

JesseHerrick
Hey, I’m Jesse and I’m the main contributor behind Dexter, a full-featured, lightning-fast Elixir LSP optimized for large codebases. It s...
New
mudasobwa
I am happy to introduce the very α version of the new programming language compiled to BEAM. Welcome Cure. It has literally three kille...
New
marciok
Hi there! We created Gust: A task orchestrator inspired by Airflow. For those who have never heard about Aiflow, it’s a Python-based wor...
New
mhanberg
Hi everyone! The first release candidate for the Expert language server project is now available! We’ve published a press release detai...
New
jimsynz
Beam Bots (or just BB for short) is a framework for building fault-tolerant robotics applications in Elixir using familiar OTP patterns. ...
New
Dmk
Xamal is a deployment tool for Elixir apps that deploys native releases to bare metal servers over SSH. It’s a port of GitHub - basecamp/...
New

We're in Beta

About us Mission Statement

Options

Thread Display Mode




Thread Preview

Skip Thread Previews