Uploaded image for project: 'Realm JavaScript SDK'
  1. Realm JavaScript SDK
  2. RJS-2785

getSyncSession cannot resolve session even though it exsist

    • Type: Icon: Bug Bug
    • Resolution: Unresolved
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: None
    • Labels:

      How frequently does the bug occur?

      Always

      Description

      I have this piece of code

      console.log('getCurrentPartitionValue()', getCurrentPartitionValue());
      syncSession = Realm.App.Sync.getSyncSession(
        realmApp().currentUser,
        getCurrentPartitionValue(),
      );
      console.log('syncSession', syncSession);
      
      const sessions = Realm.App.Sync.getAllSyncSessions(
        realmApp().currentUser,
      );
      console.log('sessions', sessions);
      syncSession = sessions.find(session => {
        return session.config.partitionValue === getCurrentPartitionValue();
      });
      console.log('syncSession', syncSession);
      

      the output is this

       LOG  getCurrentPartitionValue() 655d5e27fce9035abdbe2654
       LOG  syncSession null
       LOG  sessions [{}]
       LOG  syncSession {}
       LOG  syncSession {"partitionValue": "655d5e27fce9035abdbe2654", "user": {}}
      

      As you can see, the same partition value and user, used in getSyncSession yield null, yet if I resolve it via getAllSyncSessions, it is exsist

      Stacktrace & log output

      Unable to find source-code formatter for language: shell. Available languages are: actionscript, ada, applescript, bash, c, c#, c++, cpp, css, erlang, go, groovy, haskell, html, java, javascript, js, json, lua, none, nyan, objc, perl, php, python, r, rainbow, ruby, scala, sh, sql, swift, visualbasic, xml, yaml
      getCurrentPartitionValue() 655d5e27fce9035abdbe2654
      syncSession null
      sessions [{}]
      syncSession {}
      syncSession {"partitionValue": "655d5e27fce9035abdbe2654", "user": {}}
      

      Can you reproduce the bug?

      Always

      Reproduction Steps

      Realm.App.Sync.getSyncSession

      Version

      ^11.10.2

      What services are you using?

      Both Atlas Device Sync and Atlas App Services

      Are you using encryption?

      Yes

      Platform OS and version(s)

      WSL2 on Windows 11

      Build environment

      Which debugger for React Native: ..

      Cocoapods version

      -

            Assignee:
            kenneth.geisshirt@mongodb.com Kenneth Geisshirt
            Reporter:
            unitosyncbot Unito Sync Bot
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: