Hi, before submitting a bug, I would like to check if I am doing everything right:
- Users store data in the same collection:
- In the runtime code we would like to fetch that data from all users in the same query (since we don’t know which users have written in that collection). So we pass an empty string as the docs state to the
storageList
method:
const getInstances: nkruntime.RpcFunction = function (
ctx: nkruntime.Context,
logger: nkruntime.Logger,
nk: nkruntime.Nakama,
payload: string
) {
const data = JSON.parse(payload);
const collection = `island-user-instances_${data.islandId}`;
const result = nk.storageList("", collection, 10000);
return JSON.stringify(result);
};
That query fails with the following error:
{"level":"error","ts":"2021-06-28T20:24:13.340Z","caller":"server/runtime_javascript.go:490","msg":"JavaScript runtime function raised an uncaught exception","mode":"rpc","id":"get_instances","error":"TypeError: expects empty or valid user id at github.com/heroiclabs/nakama/v3/server.(*runtimeJavascriptNakamaModule).storageList.func1 (native)"}
If we pass a valid userID on the other hand the query works as expected. We are using the latest Nakama build using docker, locally.