Datastore Error : 502

502: API Services rejected request with error: HTTP 0 (HTTP 403 (HTTP/1.1 403 Forbidden))

local DataStoreService = game:GetService("DataStoreService")
local DataStore = DataStoreService:GetDataStore("Save2")

game.Players.PlayerAdded:connect(function(player)
	if players[player.Name] then return end
	--Defaults player data
	players[player.Name] = {
		Money = 0,
		Balance = 0,
	}
	active[player.Name] = false
	
	--Load player data if exists
	local success, data = pcall(function()
		return DataStore:GetAsync("p_"..player.UserId)
	end)

	print(data)
	if typeof(data) == "table" then
		players[player.Name] = data
	end
end)

My friends and I have been stuck on this issue for a month now, unsure if it’s a silly error or a silly goose mistake. We’ve considered the following:

  • Enabled API access to Studio
  • Enabled HTTPServices

Any response would be helpful, please save us from our suffering.

4 Likes

Are you using TC on a non group place

This always happens to me if i have Team Create access on a place that another user owns

2 Likes

Unfortunately we don’t think that’s the issue. We’ve got the other game using Team Create on a non-group place but it’s operating fully without errors.

2 Likes

Does it work in a live server?

2 Likes

I just need to clarify: when you say “considered the following”, did you actually do it?

3 Likes

This is likely the issue:

I track datastore failures and there is a huge spike every Saturday. 403 errors are a major part of the spike:

Do you get this error 100% of the time or just very frequently?

1 Like

Are your requests being throttled?

I know yesterday (Saturday) I was getting a lot of 502 throttle warnings even though I had a lot of available datastore requests.

Yes we did

100% of the time.

If you copy your place over to a new place (that has studio API access enabled), does it work?