Skip to content

fix(line): respect proxy env vars in LINE adapter HTTP sessions#23357

Closed
AhmetArif0 wants to merge 1 commit into
NousResearch:mainfrom
AhmetArif0:fix/line-client-trust-env
Closed

fix(line): respect proxy env vars in LINE adapter HTTP sessions#23357
AhmetArif0 wants to merge 1 commit into
NousResearch:mainfrom
AhmetArif0:fix/line-client-trust-env

Conversation

@AhmetArif0

Copy link
Copy Markdown
Contributor

Problem

All five aiohttp.ClientSession instances in _LineClient ignore proxy
environment variables (HTTP_PROXY, HTTPS_PROXY, ALL_PROXY). Users
running Hermes behind a corporate or transparent proxy see every LINE API
call fail — reply, push, loading, fetch_content, and
get_bot_user_id all bypass the system proxy.

Root Cause

aiohttp.ClientSession defaults to trust_env=False. Without this flag
the session ignores proxy env vars and goes direct even when the host
network requires a proxy.

All five session constructions in _LineClient omit the flag:

```python

reply(), push(), loading(), fetch_content(), get_bot_user_id()

async with aiohttp.ClientSession(timeout=timeout) as session: # ← no trust_env
```

Fix

Add trust_env=True to each of the five aiohttp.ClientSession() calls
in _LineClient. Symmetric with the wecom (wecom.py:276) and weixin
(weixin.py:1055, 1268, 1274) adapters, which already set this flag.

```python
async with aiohttp.ClientSession(timeout=timeout, trust_env=True) as session:
```

No behavior change for users not running behind a proxy.

@alt-glitch alt-glitch added type/bug Something isn't working comp/plugins Plugin system and bundled plugins P3 Low — cosmetic, nice to have labels May 10, 2026
@AhmetArif0

Copy link
Copy Markdown
Contributor Author

Reopening with correct author attribution.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/plugins Plugin system and bundled plugins P3 Low — cosmetic, nice to have type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants