Data Stores key size check is incorrect when AllScopes = true

Reproduction Steps

To reproduce this issue:

  1. Try accessing a scoped datastore without AllScopes and with a scope 50 chars long
  2. Try accessing a scoped datastore entry with AllScopes and with a scope 50 chars long
-- This works:
game:GetService("DataStoreService"):GetDataStore("test", ("a"):rep(50), options):GetAsync(("b"):rep(20))

-- This does not work, even though it's the same thing:
local options = Instance.new("DataStoreOptions")
options.AllScopes = true
game:GetService("DataStoreService"):GetDataStore("test", "", options):GetAsync(("a"):rep(50) .. "/" .. ("b"):rep(20))

Expected Behavior

I expect DataStoreService to parse the “key” when AllScopes is true and apply the 50 characters limit to the scope and key individually. The maximum length of the “key” when AllScopes is true should be 101 characters: 50 for the scope, 50 for the key, and 1 for the slash between them.

Actual Behavior

DateStoreService applies the 50-character limit to the combined scope + key used when AllScopes is true. This means that if individually the scope and key would work when AllScopes = false, they may fail when AllScopes = true if #scope + #key + 1 is bigger then 50

Data Store Limits page for context

Workaround

The only workaround for this is to create different Data Stores for each scope.

Issue Area: Engine
Issue Type: Other
Impact: Moderate
Frequency: Often
Date First Experienced: 2022-06-10 21:45:00 (-05:00)
Date Last Experienced: 2022-06-10 21:45:00 (-05:00)

1 Like

Thanks for reporting, we will look into it.

2 Likes

The fix was just enabled. Please let us know if you have any questions. Thanks!

1 Like