Realm: user must be of type 'object', got (undefined)

Hey guys i wrote a redux-thunk function which seems to executing which which i’m not running. the code below:

export const getItems = createAsyncThunk("getItems", async (user) => {

  const response = useRealm.objects("Item").map((items) => {
    return items;
  });
  return response;
})

and i wrote a realm database function which user and partitionValue are number when the app loads which shouldn’t cause a problem as there’s no function calling. code below:

export const useRealm = new Realm({
  schema: [ItemSchema],
  sync: {
    user: app?.currentUser,
    partitionValue: app?.currentUser,
  },
});

But when i run the app i get this error:

index.ts?77fd:15 Uncaught Error: user must be of type 'object', got (null)
    at eval (index.ts?77fd:15)
    at Object../src/realm/index.ts (renderer.js:5394)
    at __webpack_require__ (renderer.js:791)
    at fn (renderer.js:102)
    at eval (index.ts?788b:2)
    at Object../src/redux/testReducer/index.ts (renderer.js:5427)
    at __webpack_require__ (renderer.js:791)
    at fn (renderer.js:102)
    at eval (index.ts?76a6:9)
    at Object../src/redux/index.ts (renderer.js:5416)

is there another way to bypass it?