From 135e967706a675c1d4d3d70d958ea82bb44bd2c6 Mon Sep 17 00:00:00 2001 From: Shahar Glazner Date: Wed, 18 Sep 2024 17:44:07 +0300 Subject: [PATCH] fix: netdata GET trigger 500 (google bot) (#1961) --- keep/api/routes/alerts.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/keep/api/routes/alerts.py b/keep/api/routes/alerts.py index f452ebfde..5935d63a4 100644 --- a/keep/api/routes/alerts.py +++ b/keep/api/routes/alerts.py @@ -318,7 +318,11 @@ async def receive_generic_event( description="Helper function to complete Netdata webhook challenge", ) async def webhook_challenge(): - token = Request.query_params.get("token").encode("ascii") + try: + token = Request.query_params.get("token").encode("ascii") + except Exception as e: + logger.exception("Failed to get token", extra={"error": str(e)}) + raise HTTPException(status_code=400, detail="Bad request: failed to get token") KEY = "keep-netdata-webhook-integration" # creates HMAC SHA-256 hash from incomming token and your consumer secret