Skip to content

Add httpx[socks] to fix hook failure under SOCKS proxy - #75

Open
supertony1990 wants to merge 1 commit into
langfuse:mainfrom
supertony1990:fix/socks-proxy-support
Open

supertony1990 wants to merge 1 commit into
langfuse:mainfrom
supertony1990:fix/socks-proxy-support

Conversation

@supertony1990

Copy link
Copy Markdown

Problem

When ALL_PROXY/all_proxy is set to a socks5:// URL (a common setup alongside HTTP_PROXY/HTTPS_PROXY, e.g. via Clash/sing-box mixed ports), Langfuse client creation fails silently every turn with:

ImportError: Using SOCKS proxy, but the 'socksio' package is not installed.

Since the hook's PEP 723 dependency block only declares langfuse, uv's isolated script environment never installs socksio, and the failure is swallowed by the fail-open design (logged to ~/.claude/state/langfuse_hook.log, turn continues normally). Users under a SOCKS proxy get zero traces exported with no visible error.

Fix

Add httpx[socks] to the script's inline dependency block so socksio is installed automatically.

Testing

Verified locally: reproduced the ImportError with the proxy env vars set, confirmed the patched dependency block resolves it (Langfuse(...) client construction succeeds under the same proxy env).

httpx requires the optional socksio dependency to talk through a SOCKS
proxy. When ALL_PROXY/all_proxy is set to a socks5:// URL (a common
setup alongside HTTP_PROXY for HTTP/HTTPS), Langfuse client creation
fails with:

  ImportError: Using SOCKS proxy, but the 'socksio' package is not
  installed.

Since the hook's PEP 723 dependency block only declares `langfuse`,
uv's isolated script environment never installs socksio, so every
turn fails silently and no traces are exported. Declaring
`httpx[socks]` alongside `langfuse` pulls it in automatically.

@claude claude Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Claude Code Review

This pull request is from a fork — automated review is disabled. A repository maintainer can comment @claude review to run a one-time review.

@CLAassistant

CLAassistant commented Sep 1, 2026

Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

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