Roblox -> Discord Webhook Proxy is giving me 504 Gateway Timeouts

I’ve been trying to make a webhook using a proxy server of mine using the fetch library of nodejs. Unfortunately it doesn’t seem to be working at all, and all I’m getting are 504 errors which are extremely difficult to debug. Any suggestions on why the server.js script isn’t sending the request body to the discord webhook?

-- Roblox script:
local response = HTTP:RequestAsync({
			Url = ,"discord.com/webhook/029302932034013"
			Body = HTTP:JSONEncode({["username"] = plr.Name,
			["content"] = "test"}),
			Headers = {
				["Content-Type"] = "application/json",
			},
			Method = "POST"
		})
-- the code below does not run until the 504 gateway timeout appears in console.
if response.success then
    print("Status Code:", response.StatusCode) -- prints 504 gateway timeout
else
    print('The request failed:', response.StatusCode)
end

Nothing gets posted to my webhook channel. If you have any tips that’d be appreciated. Thanks!

1 Like

Discvord is blocking data that sent from Roblox, try using THIS

504 Gateway Timeout server error response code indicates that the server, while acting as a gateway or proxy, did not get a response in time from the upstream server that it needed in order to complete the request. In short the request is not being processed quickly enough

Thanks, but I’m using my own proxy server. My proxy server is not working

Thanks as well, I’m aware that it means the proxy didn’t respond within a reasonable timeframe, but can I confidently assume that means there were no errors with my nodejs code and rather a permanent yield? When I attach a .catch to the fetch function that doesn’t fire any response back either so it must be hanging at the fetch call line. Any guesses on what might’ve gone wrong in that case?

Well form the js code you shown you are not sending back any status code response and that is causing the request to go through but roblox to think that you haven’t handled the request in time throwing error 504

1 Like

Would u mind showing the full code of your proxy? I think I know what’s happening

1 Like

Oh wait…


I’m so dumb haha. I know what went wrong.

Yep, exactly what I thought. Node.js doesn’t have the js fetch api. Instead you need to use node fetch in order to use fect in node

1 Like

Fetch is not defined in Javascript, it is in the browser so to use fetch on backend you need to install node-fetch

The worst part is that it just returned a 504 gateway and no errors. I did have a catch statement for the fetch (I’m using axios instead now which works) but the catch didn’t fire the error response.

I had to run a nodemon local server to see the bug, which I suppose that’s what I was supposed to be doing the whole time(new to this lol)

Code?

Asumming you’re using a try catch block, you have to throw a new error when res fails. So that the catch block fires. Alternatively you can just remove the await from the axios request and add in a .catch() that’ll fix it to.

Nodemon doesn’t impact how errors are displayed, Nodemon is just a package to auto run a command after making changes to a file

1 Like

image
Pretty much this. But I assume since fetch was never defined it just hangs there indefinitely? I never once got an error 400 returned to roblox studio. (Also assume the link in the lua script is my proxy)

The catch isn’t logging the error so that’s why. Add console.log(err)

1 Like

It’s fairly hard to help with very vague code. Please paste ur full code here. You can edit out ur webhook url from the code.

It’ll make it a lot easier to help and find a fix quicker :slight_smile:

1 Like

That’s not what I meant, basically I just ran a localhost server to debug and see the console output

I have it working now with axios, I looked up why it wasn’t catching the ‘fetch not defined’ error and its because a promise was never created in the first place since the program errored before it could be created.

I appreciate the help!

Just to specify, “fetch is not defined” doesn’t occur because a promise isn’t created but because fetch doesn’t exist in node.js

2 Likes

Yep, the promise isn’t created as an effect of fetch not being defined.