slackapi / slackapi/python-slack-sdk

`slack_file` image blocks appended with `chat.appendStream` render as missing images inline

オープン
#1,961 コメント 3 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

needs info server-side-issue
主要言語
Python
スター
4k
フォーク
857
平均マージ
22時間 21分
マージ済み PR(30日)
16

説明

Description

When an image block referencing a Slack-hosted file is appended to a streaming message using chat.appendStream, Slack initially renders a missing-image placeholder.

Clicking the missing image opens and displays the correct image, which indicates that:

  • The file ID is valid.
  • The upload completed successfully.
  • Slack generated the image thumbnail.
  • The original image remains accessible.

The same streamed message's DOM contains a valid Slack thumbnail URL, but Slack replaces the inline background image with an unable-to-load-error asset.

This may be a server-side file-sharing/association issue specific to blocks appended through the streaming APIs.

Reproducible in:
The Slack SDK version

3.43.0

Bot scopes:

  • chat:write
  • files:read
  • files:write
Python runtime version

3.13.7

OS info

ProductName: macOS
ProductVersion: 26.6.2
BuildVersion: 25G83

Steps to reproduce:

(Share the commands to run, source code, and project settings (e.g., pyproject.toml))

  1. Upload a PNG to Slack without posting a separate file message:
upload_response = await client.files_upload_v2(
    content=png_bytes,
    filename="sample.png",
)

file_id = upload_response["file"]["id"]
  1. Wait until files.info reports that the image and its thumbnail are ready:
file_info = await client.files_info(file=file_id)
file = file_info["file"]

assert file["mimetype"] == "image/png"
assert file["filetype"] == "png"
assert file["thumb_360"]
assert file["thumb_360_w"]
assert file["thumb_360_h"]
  1. Start a streaming message:
response = await client.chat_startStream(
    channel=channel_id,
    thread_ts=thread_ts,
)

stream_ts = response["ts"]
  1. Append an image block using the Slack file ID:
await client.chat_appendStream(
    channel=channel_id,
    ts=stream_ts,
    chunks=[
        {
            "type": "blocks",
            "blocks": [
                {
                    "type": "image",
                    "slack_file": {
                        "id": file_id,
                    },
                    "alt_text": "Sample Image",
                }
            ],
        }
    ],
)
  1. Stop the stream:
await client.chat_stopStream(
    channel=channel_id,
    ts=stream_ts,
)
Expected result:

The Slack-hosted image should render inline in the completed streaming message.

Actual result:

Slack renders a missing-image placeholder.
Clicking the placeholder opens and displays the correct image.
Inspecting the rendered HTML shows that Slack resolved the file to a generated thumbnail URL:

<a
  class="c-link c-message_attachment__image"
  href="https://files.slack.com/files-tmb/.../chart_480.png"
  style="
    background-image:
      url('https://a.slack-edge.com/.../unable-to-load-error-....png');
  "
>
  <span role="img" aria-label="missing image"></span>
</a>
Image

The href points to the generated Slack thumbnail, while the inline background is replaced with Slack's unable-to-load-error image.

Requirements

For general questions/issues about Slack API platform or its server-side, could you submit questions at https://my.slack.com/help/requests/new instead. 🙇

Please read the Contributing guidelines and Code of Conduct before creating this issue or pull request. By submitting, you are agreeing to those rules.

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

調査の方向性

まず、記載されているバージョンを使って、files_upload_v2、files_info、chat_startStream、chat_appendStream、chat_stopStream のシーケンスを再現します。SDK のリクエスト payload と Slack のストリーミング API の挙動を比較し、失敗が SDK にあるのかサーバー側にあるのかを判断します。SDK 側の変更が特定された場合に、原因を文書化し、対象を絞った回帰テストを追加すれば完了です。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
python
領域
api
issue の種類
バグ
難易度
4/5
見積もり時間
3〜5日
活発さ
活発
明瞭さ
説明が足りない
初心者へのやさしさ
35/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。