heroiclabs / nakama-unity

Unity client for Nakama server.
https://heroiclabs.com/docs/unity-client-guide
Other
407 stars 75 forks source link

Storage write rejected - version check failed #150

Closed justinbalaguer closed 1 year ago

justinbalaguer commented 1 year ago

Suddenly have this error when using WriteStorageObjectsAsync

image

code is similar to sample here https://heroiclabs.com/docs/nakama/concepts/storage/collections/#conditional-writes

var saveGame = "{ \"progress\": 50 }";

var objectIds = await client.WriteStorageObjectsAsync(session, new [] { 
  new WriteStorageObject
  {
      Collection = "saves",
      Key = "savegame",
      Value = saveGame,
      Version = "<version>"
  }
});

Tried restarting the server and deleting saved account and storage still having that error.

novabyte commented 1 year ago

@justinbalaguer What version of the game server do you use?

justinbalaguer commented 1 year ago

@justinbalaguer What version of the game server do you use?

3.15.0 for nakama 2021.3.7f1 for unity

lugehorsam commented 1 year ago

@justinbalaguer What are you passing as the version? Is it the value you receive when you get the storage objects, and is your storage key experiencing concurrent writes?

justinbalaguer commented 1 year ago

collectionObject is from a ScriptableObject image image

lugehorsam commented 1 year ago

@justinbalaguer this error means that you are passing a value of Version that is different than what the server has for your data. The most likely cause is that you aren't passing the version from the acknowledgment of your last write or "*" if it's your first write:

https://heroiclabs.com/docs/nakama/concepts/storage/collections/#conditional-writes

Closing because this doesn't seem to be an SDK issue. If you can fully reproduce a bug on the server please file it on our Nakama repo: https://github.com/heroiclabs/nakama