slackapi / slackapi/python-slack-sdk
files_upload_v2 returns internal_error when using markdown in blocks
Nadie ha tomado este issue todavía.
- Lenguaje dominante
- Python
- Estrellas
- 4k
- Forks
- 857
- Merge medio
- 22 h 21 min
- PR fusionados (30 d)
- 16
Descripción
files_upload_v2 returns internal_error when using markdown in blocks parameter
Reproducible in:
slack-bolt==1.25.0
slack-sdk==3.36.0
Python 3.13.5
ProductName: macOS
ProductVersion: 15.5
BuildVersion: 24F74
Darwin Kernel Version 24.5.0
The Slack SDK version
slack-bolt==1.25.0
slack-sdk==3.36.0
Python runtime version
Python 3.13.5
OS info
ProductName: macOS
ProductVersion: 15.5
BuildVersion: 24F74
Darwin Kernel Version 24.5.0: Tue Apr 22 19:53:27 PDT 2025; root:xnu-11417.121.6~2/RELEASE_ARM64_T6041
Steps to reproduce:
1. Code Example
from slack_sdk.web.async_client import AsyncWebClient
import json
# Initialize client
client = AsyncWebClient(token="xoxb-your-token")
# Prepare parameters
channel_id = "D099T7G7VHD" # DM channel
blocks = [{"type": "markdown", "text": "_**Haim Raitsev** posted a new message_\\n> test"}]
files = [{"id": "F09J0L8TDRQ", "title": "screenshot.png"}]
# Attempt to upload with blocks
response = await client.files_upload_v2(
channel=channel_id,
file_uploads=[
{
"content": b"<file_bytes_here>",
"filename": "screenshot.png",
"title": "screenshot.png"
}
],
blocks=json.dumps(blocks)
)
2. Response
{
"ok": False,
"error": "internal_error"
}
Expected result:
The file should be uploaded successfully with the rich text blocks displayed in the message, as the underlying files.completeUploadExternal:
Actual result:
The API returns {"ok": false, "error": "internal_error"} without any additional error details.
Additional Context:
This issue is reproduced only when we have a new markdown block (https://docs.slack.dev/reference/block-kit/blocks/markdown-block/) when we use other blocks the message posted correctly.
files.completeUploadExternal API Call
HTTP Request
POST https://slack.com/api/files.completeUploadExternal HTTP/1.1
Host: slack.com
Authorization: Bearer xoxb-your-token-here
Content-Type: application/x-www-form-urlencoded
Request Details
Method: POST
URL: https://slack.com/api/files.completeUploadExternal
Headers:
Authorization: Bearer xoxb-your-token-here
Content-Type: application/x-www-form-urlencoded
Body (URL-encoded):
files=[{"id":"F09J0L8TDRQ","title":"screenshot.png"}]
channel_id=D099T7G7VHD
blocks=[{"type":"markdown","text":"_**Haim Raitsev** posted a new message_\\n> test"}]
Body Parameters Breakdown
| Parameter | Value | Description |
|---|---|---|
files |
[{"id":"F09J0L8TDRQ","title":"screenshot.png"}] |
JSON array of file objects (URL-encoded) |
channel_id |
D099T7G7VHD |
DM channel ID where file will be shared |
blocks |
[{"type":"markdown","text":"_**Haim Raitsev** posted a new message_\\n> test"}] |
JSON array of blocks (URL-encoded) |
Example using cURL
curl -X POST https://slack.com/api/files.completeUploadExternal \
-H "Authorization: Bearer xoxb-your-token-here" \
-H "Content-Type: application/x-www-form-urlencoded" \
--data-urlencode 'files=[{"id":"F09J0L8TDRQ","title":"screenshot.png"}]' \
--data-urlencode 'channel_id=D099T7G7VHD' \
--data-urlencode 'blocks=[{"type":"markdown","text":"_**Haim Raitsev** posted a new message_\\n> test"}]'
Error Response (Current Issue)
{
"ok": false,
"error": "internal_error"
}
Thank you for maintaining this excellent SDK!
Guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Línea de trabajo
Comienza en AsyncWebClient.files_upload_v2 y sigue la solicitud enviada a files.completeUploadExternal, comparando el bloque de markdown con los bloques que tienen éxito. Reproduce la solicitud del issue y determina si el payload del SDK o la Slack API es responsable. Se considera terminado cuando la causa esté aislada y el issue tenga un fix verificado o una limitación documentada del upstream.
Escrito por el modelo de indexación a partir del texto del issue.
Evaluación
- Stack tecnológico
- python
- Área
- api, backend
- Tipo de issue
- Error
- Dificultad
- 4/5
- Tiempo estimado
- 3-5 días
- Estado de actividad
- Activo
- Claridad
- Bastante claro
- Aptitud para principiantes
- 42/100