502: API Services rejected request with error. HTTP 403 (Forbidden)

Howdy all,

I am currently unable to access DataStores from Studio and am befuddled as to why.
This simple code produces that 502 error code consistently when playing in Studio:

local dataStoreService = game:GetService("DataStoreService")
local ds = dataStoreService:GetOrderedDataStore("dataStore")
ds:SetAsync("Key", 5)

Things to note:

  1. I am not using Team Create. I am the owner of the place.
  2. I have enabled studio access to apis via Game Settings(See photo):
  3. Studio access to api services is enabled through website game settings(See photo).
  4. DataStores work flawlessly in-game.

Anyone know what I could possibly be doing wrong? Any help is much appreciated.

2 Likes

Is this in a local script or server script? Local scripts cannot access data stores.

2 Likes

Not the issue, the error is different if you attempt to use DataStores from the client.

Receiving status codes back suggests that the request successfully went through but could not be processed and was thus rejected. 403 means insufficient permissions, 502 means Roblox servers encountered an error while processing the request.

This is what you see on the client if you try using DataStores:
image

@thetacah Could you link the place in question that’s giving you troubles?

1 Like

OP is saying the DataStore only gives this error in studio. If you didn’t click the edit button, you need to run SetPlaceId() Have you followed this guide? Data Stores | Documentation - Roblox Creator Hub
What’s the full error? Is it just “Error 502?”

1 Like

That wasn’t what I was addressing though. I was addressing the misconception that this error could be possible from a LocalScript, which it isn’t, because clients can’t use DataStores in the first place.

SetPlaceId is only required if you want to interact with the DataStores of an unpublished place, provided you have sufficient access credentials (only the owner of a game can access its DataStores). Otherwise, it’s not required - developers have been able to test DataStores in Studio without issue.

The full error is the title. There are other posts about this same issue as well. HTTP 403 is what the web server is returning, Error 502 is what Roblox API services are returning. As DynamoDB denied write access to the DataStore, DataStoreService could not process the request and thus returned its own error plus the web server’s error to the console.

2 Likes

I see, thanks for clearing up my misconception.

All,

This issue seems to have fixed itself automatically overnight (I am no longer receiving this strange error).
Consider the matter as resolved.

Cheers.

1 Like