AsyncOAuthFlow raises UnboundLocalError on org-wide install without a bot token

未關閉
#1,596 1 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視

維護者通常 1 天內回覆

@sahiljagtap08 已經在處理了。

開始於 2026年10月8日。

  • #1590 來自 @sahiljagtap08 —— 未關閉

評估

難度
2/5
預估耗時
1-3 小時
新手友好度
35/100
Issue 類型
缺陷
描述清晰度
描述清楚
活躍度
活躍
技術堆疊
python

研究方向

The crash is in slack_bolt/oauth/async_oauth_flow.py in AsyncOAuthFlow.run_installation, where auth_test is read for enterprise installs but only assigned inside the bot-token branch. Compare it with the sync OAuthFlow.run_installation, which keeps that lookup under if bot_token is not None:. A fix already exists in linked PR #1590 with tests, so review or extend that PR rather than starting a parallel one. Done means an org-wide install with user scopes only saves the installation and redirects without raising UnboundLocalError.

由索引模型根據 Issue 內容生成。

描述

auto-triage-stale
Reproducible in:
The slack_bolt version
slack_bolt==1.30.0
slack_sdk==3.45.0
Python runtime version
Python 3.12.5
OS info
macOS 27.0
Steps to reproduce:

Use AsyncApp with OAuth and have an Enterprise Grid org install the app with only user scopes (no bot scopes). The oauth.v2.access response then has no access_token for the bot and is_enterprise_install is true.

  1. Configure AsyncOAuthFlow with user scopes only.
  2. Install the app at the organization level (org-wide install).
  3. Complete the OAuth redirect.
Expected result:

The installation is saved and the redirect succeeds, the same as it does with the sync OAuthFlow.

Actual result:

AsyncOAuthFlow.run_installation in slack_bolt/oauth/async_oauth_flow.py raises:

UnboundLocalError: cannot access local variable 'auth_test' where it is not associated with a value

The code reads auth_test.get("url") for enterprise installs, but auth_test is only set when a bot token exists. The sync OAuthFlow.run_installation nests that line inside the if bot_token is not None: block, so the two have drifted apart.

I have a fix that mirrors the sync version, with tests for both, in #1590.

Requirements

I have read the Contributing guidelines and Code of Conduct.

主要語言
Python
星號
1.3k
分支
300
平均合併
19 小時 33 分鐘
30 天內合併 PR
25

環境準備

從這裡開始

  1. 先讀完整個 Issue,再讀專案的貢獻指南。
  2. 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
  3. Fork 儲存庫,在一個分支上完成修改。
  4. 送出 Pull Request,並在描述裡引用這個 Issue 編號。

slackapi/bolt-python 的其他 Issue

查看 slackapi/bolt-python 的全部 Issue

相似的 Issue

更多 Python Issue

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。