-
Notifications
You must be signed in to change notification settings - Fork 218
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
In image block, unfetchable image_url leads to message never posted instead of falling back to alt_text or fallback #1396
Comments
Hi there, It's the expected behaviour that the You could try using a section block with an image element, which would still send the message if the image URL is broken. (The client will show a placeholder if the image cannot be fetched) |
Hello, I tried (or so I think) what you suggested: section block with an image element. Here is the Kotlin code: withBlocks {
section {
markdownText(text)
}
section {
this@withBlocks.image {
val title = imageTitle ?: "Attached image"
title(title)
fallback(title)
altText(title)
imageUrl("http://localhost:8091/timeout.jpg")
}
}
} The message is never posted for any URL, valid, 404 or timeout. I even tried to trigger a SocketTimeoutException by using a local server that just sleeps on any GET, no exception is there, nothing in our logs. We also tried another solution that works: using an accessory image: withBlocks {
section {
markdownText(text)
accessory {
image(
//imageUrl = "https://www.google.com/images/branding/googlelogo/1x/googlelogo_color_272x92dp.png",
imageUrl = "http://localhost:8091/timeout.jpg",
altText = "alt text",
)
}
}
} With the accessory any URL works (valid, 404, timeout) (in case of invalid URL the message is posted with a broken icon). Unfortunately it doesn't fit all use cases as the thumbnail is small. |
👋 It looks like this issue has been open for 30 days with no activity. We'll mark this as stale for now, and wait 10 days for an update or for further comment before closing this issue out. If you think this issue needs to be prioritized, please comment to get the thread going again! Maintainers also review issues marked as stale on a regular basis and comment or adjust status if the issue needs to be reprioritized. |
It seems that on chatPostMessage of a message containing an image block, the SDK tries to fetch the image located at image_url with OkHttp 4.11.0 and any other result than a successful image fetch leads to chatPostMessage failing silently and never posting the message, e.g. any response code other than HTTP 200 fails silently and the special case of an HTTP timeout leads to a SocketTimeoutException.
The Slack SDK version
Gradle
versions.properties
:Java Runtime version
OS info
Reproduced in local:
Note that this is also reproduced when deployed on our AWS (I don't know the architecture details).
Steps to reproduce:
build.gradle.kts
bits that may be relevant:Expected result:
Message should be posted without image and with the alt_text or fallback.
Actual result:
Message is never posted, nothing in logs for example with a 404 image URL. With a URL that times out, we get the following logs:
The text was updated successfully, but these errors were encountered: