Two code examples. Both should work, but only B does.
I try to “create or update” an object in storage engine:
  let version = undefined; // ...
  const saveItem = {
    collection: COLLECTION_XS,
    key: req.id,
    userId: ctx.userId,
    value: x,
    version: version,
    permissionRead: 1,
    permissionWrite: 0
  } as nkruntime.StorageWriteRequest;
  const ack = nk.storageWrite([saveItem]);
  // TypeError: expects 'version' value to be a string at github.com/heroiclabs/nakama/v3/server.(*runtimeJavascriptNakamaModule).storageWrite.func1 (native)
  let version = undefined;
  const saveItem = {
    collection: COLLECTION_XS,
    key: req.id,
    userId: ctx.userId,
    value: x,
    // version: version, // omited
    permissionRead: 1,
    permissionWrite: 0
  } as nkruntime.StorageWriteRequest;
  const ack = nk.storageWrite([saveItem]);
  // Works
So in order to actually create an object, i have to branch my code so in the create aspect i do not supply a version property? Your API defines nkruntime.StorageWriteRequest->version to be undefined, but then in the execution it fails. Thats a clear contradiction…
- Versions: I was on Nakama 3.14, upgraded to latest (went through a lot of pain upgrading cockroach; the previous cockroach version is completly uncompatible with newer nakama builds, you get very strange errors there) but the same behavior on the new version.
- Server Framework Runtime language (If relevant) TS
I am having a workaround thanks to lodash’s omitBy function, which removes all undefined values. I thought i leave this here for others.
  const saveItem = _omitBy({ ... }, _isUndefined) as unknown as nkruntime.StorageWriteRequest;
  const ack = nk.storageWrite([saveItem]);
As said, this is an error in nakama-common type declaration and needs a fix. I don’t see where in the code exactly this is done so i am not sure where to even start debugging (i’m no Go dev)