AsyncManagementClient with custom_domain fails every request with TypeError
評估
研究方向
從AsyncManagementClient.__init__開始,檢查_enforce_custom_domain_whitelist如何註冊到httpx.AsyncClient的請求鉤子中;並與同步版ManagementClient的行為比較。使用提供的httpx.MockTransport範例重現,接著確認請求成功,且Auth0-Custom-Domain在允許清單中的路徑上保留,在其他路徑上移除。
由索引模型根據 Issue 內容生成。
描述
Description
When you create AsyncManagementClient with custom_domain, every request raises:
TypeError: object NoneType can't be used in 'await' expression
AsyncManagementClient.__init__ adds _enforce_custom_domain_whitelist to the request event hooks of an httpx.AsyncClient. That function is synchronous. httpx.AsyncClient awaits each request hook (await hook(request)), so awaiting the None it returns raises TypeError before the request is sent. The sync ManagementClient is not affected.
Reproduction
import asyncio
import httpx
from auth0.management import AsyncManagementClient
async def main():
client = AsyncManagementClient(
domain="tenant.auth0.com",
token="TOKEN",
custom_domain="login.example.com",
httpx_client=httpx.AsyncClient(
transport=httpx.MockTransport(lambda r: httpx.Response(200, json={}))
),
)
await client.users.get("auth0|abc123")
asyncio.run(main())
The same error occurs without httpx_client, since the SDK then creates its own httpx.AsyncClient and adds the same hook.
Additional context
Expected: the request is sent, with the Auth0-Custom-Domain header kept on whitelisted paths and removed on other paths, as with ManagementClient.
httpx 0.28.1. Custom domain support was added in #799.
auth0-python version
6.8.0
Python version
3.12
- 主要語言
- Python
- 星號
- 578
- 分支
- 191
- 平均合併
- 2 天 20 小時
- 30 天內合併 PR
- 4
環境準備
- 沒有 Dockerfile 或 Docker Compose 檔案
- 有 Pull Request 範本
- 閱讀貢獻指南
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
auth0/auth0-python 的其他 Issue
-
SyntaxWarning: invalid escape sequence '\(' in auth0/management/types/client_metadata.py (6.8.0)未關閉
難度 2/5 1-3 小時 新手友好度 68/100
auth0/auth0-python#908 · 1 則留言 ·
-
pushed_authorization_request sends list authorization_details as a Python repr可能已有人在做 @RaphaelFakhri 於 32 天前認領。 未關閉
難度 2/5 1-3 小時 新手友好度 78/100
auth0/auth0-python#903 ·
-
bug
難度 2/5 1-3 小時 新手友好度 68/100
auth0/auth0-python#852 ·
-
bug
難度 3/5 1-2 天 新手友好度 68/100
auth0/auth0-python#856 · 4 則留言 · 1 個 reaction ·
-
bug
難度 3/5 1-2 天 新手友好度 45/100
auth0/auth0-python#789 · 1 則留言 · 1 個 reaction ·
查看 auth0/auth0-python 的全部 Issue
相似的 Issue
-
enhancement
難度 2/5 1-3 小時 新手友好度 72/100
維護者通常 1 天內回覆
-
bug
難度 1/5 1 小時以內 新手友好度 89/100
維護者通常 1 天內回覆
-
DoRA magnitude vectors are not loaded by Transformers load_adapter / from_pretrained(adapter_dir)未關閉post-v1
難度 2/5 1-3 小時 新手友好度 72/100
huggingface/peft#4208 · 1 則留言 ·
維護者通常 1 天內回覆
-
approved correction metadata
難度 1/5 1 小時以內 新手友好度 76/100
acl-org/acl-anthology#10996 · 2 則留言 ·
維護者通常 1 天內回覆
-
needs-triage
難度 1/5 1-3 小時 新手友好度 85/100
gke-labs/kube-agents#6620 ·
維護者通常 1 天內回覆