Conversation
A Slack client URL (https://app.slack.com/client/T…/D…) answers a POST with the web app and HTTP 200. post() only checked `status_code < 400`, so it read that as a delivered message: the bot logged "Notified Slack about thread …" while nothing was ever posted. Two checks, because either one alone still leaves a hole: - The URL must start with https://hooks.slack.com/services/. Validated once in __init__ so a misconfigured value is one loud error at startup instead of one line per notification. - A 2xx is not enough. An Incoming Webhook answers with the body "ok"; anything else means the endpoint is not a webhook, however healthy the status code looks. Found in production: the deployed .env held a DM link instead of a webhook, and the bot reported success on every thread. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
El fallo
Una URL de cliente de Slack (
https://app.slack.com/client/T…/D…) responde a un POST con la web de Slack y HTTP 200.post()sólo mirabastatus_code < 400, así que lo interpretaba como entrega correcta: el bot logueabaNotified Slack about thread …sin haber publicado nada.Salió en producción — el
.envdesplegado tenía un enlace a un DM en vez de un webhook, y el bot reportaba éxito en cada hilo. El falso positivo hizo que buscáramos el problema en Discord durante un buen rato.El arreglo
Dos comprobaciones, porque cada una por separado deja un hueco:
https://hooks.slack.com/services/. Se valida una sola vez en__init__, así una configuración errónea es un error claro al arrancar en lugar de una línea por notificación.ok; cualquier otra cosa significa que el endpoint no es un webhook, por muy sano que parezca el status.La primera sola no bastaría: un webhook borrado en el dominio correcto puede responder cosas distintas de
ok. La segunda sola tampoco: sin ella, cualquier host que devuelvaokpasaría por bueno.Verificación
OK\nsí cuenta como entrega..envde producción: el notifier se deshabilita y deja una línea de error.ruff checkyruff format --checklimpios.🤖 Generated with Claude Code