Error coming from data store 2

This error is coming from the datastore2 module I have in my game.

502: API Services rejected request with error. HTTP 500 (Internal Server Error)

It’s coming from this module script:

This line, to be more specific:

Code here
function OrderedBackups:Get()
	return Promise.async(function(resolve)
		resolve(self.orderedDataStore:GetSortedAsync(false, 1):GetCurrentPage()[1])
	end):andThen(function(mostRecentKeyPage)
		if mostRecentKeyPage then
			local recentKey = mostRecentKeyPage.value
			self.dataStore2:Debug("most recent key", mostRecentKeyPage)
			self.mostRecentKey = recentKey

			return Promise.async(function(resolve)
				resolve(self.dataStore:GetAsync(recentKey))
			end)
		else
			self.dataStore2:Debug("no recent key")
			return nil
		end
	end)
end

Is this a harmless error? A script that uses ds2 in my game is malfunctioning and I think this may be why.

1 Like

I just had a bunch of those errors coming from my datastore and other HTTP related things(Such as GetRoleInGroup()) in studio. It has seemed to stop, but I believe it might have been with something on roblox’s part. The actual game servers seemed to be fine though.

1 Like

I have that on already.

502
Error X occurred when processing on Roblox servers. Depending on the response, you may want to retry the request at a later time.

1 Like

Hey! This post is a bit old, but I’ve recently encountered this error using DataStore2.
Below is my tested working solution to resolving this issue.
Simply replace the code at OrderedBackups:28 to this:

    local su, re;
	repeat
		su, re = pcall(function()
			return self.orderedDataStore:GetSortedAsync(false, 1):GetCurrentPage()[1] 
		end)
		--warn("HTTP ERROR!")
	until su == true
	resolve(re)

So, go from this:

to this:

Hopefully this helps anyone dealing with this too!