Issue with API (only in-game) with HTTP requests resulting in "NetFail"

Hi, basically I’m trying to access my API in my Roblox game - it worked a while ago (maybe 2 months) but when coming back to work on the project again it is not working, and I get “HttpError: NetFail” shown in output. The API request works in studio, but not in-game.

I have tried creating a new studio, requesting data from the api via a get request individually, with still the same outcome. I have also tried changing port to 3000 (as I know there was a port restriction on a Roblox update), as well as updating the TLS minVersion on my express api (to 1.2). This just resulted in the same error.

Additionally, I have also tried sending GET requests via postman and it fetches the data successfully. I have looked over the most recent updates to http service and cannot seem to find anything else which may be relevant to this breakage.

My code is functional as I’ve tried it with other API requests (and it also works in studio) - so I’m wondering if there is another aspect I’ve missed out which will allow this to be resolved?

Thank you :slight_smile:

Edit, the code I use when sending get requests:

function DataService.get(data_type, action_type, arguments, bypass_decode)
	local FormattedUrl = DataService:_formatUrl(data_type, action_type, arguments)

	local data
	local decoded_data
	
	local success,error= pcall(function()
		data = HttpService:GetAsync(FormattedUrl)
		if not bypass_decode then
			decoded_data = HttpService:JSONDecode(data)
		end
	end)

	local ArgumentFormatted = table.concat(arguments, ",")

	if success then
		warn("[DataService] -> Got type: "..data_type..", with action: "..action_type..". Url Arguments: "..ArgumentFormatted)
		
		if bypass_decode then
			return true
		else
			return decoded_data
		end
	else
		print(error)
		warn("[DataService] [ERR] -> Couldn't get type: "..data_type..", with action: "..action_type..". Url Arguments: "..ArgumentFormatted)
		return false
	end
end
1 Like

You need to send your script so we can see the issue.

If this works, can’t you just use that method?

Updated the post now for some context :slight_smile:

I’m using postman which is an external website to check if my api is functional, and it is fetching data successfully, but I’m wanting to get the data from Roblox via http service.

Are there any errors or warnings?

I only get “HttpError: NetFail”, so I’m not really sure what else to try.

I’m also seeing this error with my game.

1 Like

If this is happening across many games, this could be a temporary service disruption. Other than that, check to make sure you allowed HTTP requests in game settings.

1 Like

Yeah possibly, however wouldn’t other requests which are successful (not using my api) show the same error if this were the case?

Probably they would. What API are you using?

I’m using a custom API I built with express (with node js). I have a feeling it doesnt work in roblox games because of some security update - however I’ve updated the tls version and port so not sure what else to try. It works in studio perfectly fine (with http requests enabled)

Hi, is this issue still ongoing?

For me, yes.

I’m unsure if this is related, but the sample code for POST requests from the HttpService documentation page also works fine in Studio but throws a 403 Forbidden error when run in play mode.

Thanks

I’m facing the same issue at the moment.

Thanks for confirming! We are looking into this now.

If you are seeing this issue, when did this problem start occurring?

If you have logs when this failure happens would you mind privately sending me your log file?

Please see here for instructions on how to find your log files: How to post a Bug Report - #12 by Roblox

Hey there, same problem for me. I have my own API and it works only in some servers (and when it works, only for a short period of time). We only get HttpError:NetFail, which means that the request doesn’t even get processed.

1 Like

this is exactly what’s happening:

Captura de pantalla 2023-07-26 224542

Thanks for bringing this issue to our attention.

After investigating it appears that HTTPS requests on ports other than 443 will fail in some situations. We recommend using only port 443 for HTTPS requests for now. We will update if/when this restriction has been eliminated.

2 Likes