Skip to content

chore: bump plug to 1.20.3 (fix Phoenix logger detach on WS upgrade) - #1125

Merged
v0idpwn merged 1 commit into
mainfrom
claude/bump-plug-1.20.3
Jul 23, 2026
Merged

chore: bump plug to 1.20.3 (fix Phoenix logger detach on WS upgrade)#1125
v0idpwn merged 1 commit into
mainfrom
claude/bump-plug-1.20.3

Conversation

@claude

@claude claude Bot commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

Requested by Jefferson Venerando, Felipe Stival · Slack thread

Before

After the Plug 1.20 bump (shipped in v2.9.9), a websocket upgrade on GET /v2 leaves conn.status nil. Plug 1.20.0 newly runs before_send callbacks on Plug.Conn.upgrade_adapter/3, which fires Phoenix's [:phoenix, :endpoint, :stop] telemetry handler while conn.status is still nil. That handler calls Plug.Conn.Status.code(nil), which raises :function_clause. Erlang :telemetry then permanently detaches the failing handler node-wide, so all per-request Phoenix logs stop appearing in Logflare until the node restarts.

The offending route is lib/supavisor_web/ws_proxy.ex, which upgrades via Plug.Conn.upgrade_adapter/3 without setting a status.

After

Bumping plug to 1.20.3 makes upgrades default conn.status to 101 before running before_send (Plug #1320), so the telemetry handler never sees nil, never raises, and request logging keeps working. 1.20.3 also carries CVE fixes.

How

Single-line mix.lock bump of plug from 1.20.1 to 1.20.3. plug is a transitive dependency (via phoenix/plug_cowboy), so there is no mix.exs change and no application code change.

Refs:


Generated by Claude Code

Plug 1.20.0 began running before_send callbacks on connection upgrade.
The GET /v2 websocket route upgrades via Plug.Conn.upgrade_adapter/3
without setting conn.status, so Phoenix's [:phoenix,:endpoint,:stop]
telemetry handler hit Plug.Conn.Status.code(nil) and raised
:function_clause. :telemetry then permanently detached that global
handler node-wide, stopping all per-request Phoenix logging until
restart.

Plug 1.20.2 (elixir-plug/plug#1320) defaults conn.status to 101 before
running before_send on upgrade, so the handler never sees nil. Bump to
1.20.3, which also carries CVE fixes. Transitive dep, mix.lock only.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DuxufDmqyTd3iswyfg5msD
@v0idpwn
v0idpwn marked this pull request as ready for review July 23, 2026 19:35
@v0idpwn
v0idpwn requested a review from a team as a code owner July 23, 2026 19:35
@v0idpwn
v0idpwn enabled auto-merge (squash) July 23, 2026 19:35
@v0idpwn
v0idpwn merged commit c65ac0a into main Jul 23, 2026
15 checks passed
@v0idpwn
v0idpwn deleted the claude/bump-plug-1.20.3 branch July 23, 2026 19:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants