(SOLVED) HTTP 429 (Too Many Request) With Developer Console Command Logger

  • Apparently, the logger works fine when I run commands in the Developer Console in Studio and I get the log message, but when I try it in-game, I get an HTTP 429 error.

  • I fully acknowledge that this error indicates too many requests being sent. However, the script only logs when a developer types a command, so I don’t think it’s due to system overload. It’s likely an issue within the script itself. Any help would be appreciated.

(Script is server-sided and is located in ServerScriptService)

local HttpService = game:GetService("HttpService")
local LogService = game:GetService("LogService")
local Players = game:GetService("Players")

local WEBHOOK_URL = "yes"

local function LogDevCommand(message)
	local sender = "Unknown"
	for _, player in pairs(Players:GetPlayers()) do
		if player:GetRankInGroup(game.CreatorId) >= 254 then
			sender = player.Name
			break
		end
	end

	local data = {
		["username"] = "thang ngot",
		["embeds"] = {{
			["title"] = "Developer Command Executed",
			["description"] = "**Command:** " .. message .. "\n**Sender:** " .. sender,
			["color"] = 16711680,
			["timestamp"] = os.date("!%Y-%m-%dT%H:%M:%SZ")
		}}
	}

	local encodedPayload = HttpService:JSONEncode(data)
	return HttpService:PostAsync(WEBHOOK_URL, encodedPayload, Enum.HttpContentType.ApplicationJson)
end

LogService.MessageOut:Connect(function(message, messageType)
	if messageType == Enum.MessageType.MessageOutput and string.sub(message, 1, 1) == ">" then
		LogDevCommand(message)
	end
end)

In studio:
studio

In-game:
ingame

I recommend using a proxy to handle ratelimiting etc, I wouldn’t directly request to the webhook.
There are a couple of free ones out there like lewisakura and
Simple Discord Webhook Proxy

I would also recommend setting up a queue system which sends the data every x seconds say 15 seconds.

1 Like

Using lewisakura fixed the problem, thanks a ton!