Skip to content

pipe_through with module plug and options doesn't compile #6711

Closed

Description

@matt-savvy

Environment

  • Elixir version (elixir -v): Elixir 1.19.5 (compiled with Erlang/OTP 28)
  • Phoenix version (mix deps): v.1.8.8
  • Operating system: MacOS / Linux

Actual behavior

Using pipe_through with a Module plug and options raises Compilation Error

 # router.ex
      pipe_through [:api, {HelloWorldPlug, greeting: "Hey there"} ]

raises

== Compilation error in file test/phoenix/router/pipeline_test.exs ==
** (ArgumentError) errors were found at the given arguments:

  * 1st argument: not an atom

    :erlang.atom_to_list({Phoenix.Router.PipelineTest.HelloWorldPlug, [greeting: "Hey there"]})
    (plug 1.18.1) lib/plug/builder.ex:329: Plug.Builder.module_plug?/1
    (plug 1.18.1) lib/plug/builder.ex:333: Plug.Builder.init_plug/2
    (plug 1.18.1) lib/plug/builder.ex:322: anonymous fn/5 in Plug.Builder.compile/3
    (elixir 1.19.5) lib/enum.ex:2520: Enum."-reduce/3-lists^foldl/2-0-"/3
    (plug 1.18.1) lib/plug/builder.ex:320: Plug.Builder.compile/3
    (phoenix 1.8.8) lib/phoenix/router.ex:667: Phoenix.Router.build_pipes/2
    (phoenix 1.8.8) lib/phoenix/router.ex:630: Phoenix.Router.build_match_pipes/3
    (phoenix 1.8.8) lib/phoenix/router.ex:595: Phoenix.Router.build_match/2
    (elixir 1.19.5) lib/enum.ex:1814: Enum."-map_reduce/3-lists^mapfoldl/2-0-"/3
    (elixir 1.19.5) lib/enum.ex:1814: Enum."-map_reduce/3-lists^mapfoldl/2-0-"/3
    (phoenix 1.8.8) expanding macro: Phoenix.Router.__before_compile__/1
    test/phoenix/router/pipeline_test.exs:22: Phoenix.Router.PipelineTest.Router (module)

Same module plug, no opts / defaults works just fine:

      pipe_through [:api, HelloWorldPlug ]

Expected behavior

The router pipeline should be able to compile and run, using the module plug with opts.

Activity

  1. added a commit that references this issue on Jul 10, 2026
    2578cc5
  2. added a commit that references this issue on Jul 20, 2026
    12a0a0c
  3. added a commit that references this issue on Aug 10, 2026
    4be68eb
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions