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

"sync is not enabled for this app" is not catchable

      Goals

      We want to give users a way to catch any sync related error.

      Expected Results

      In particular, we should enable users to catch the "sync is not enabled for this app" error printed by the sync client log while connecting to a server that doesn't have sync enabled:

      > Connection[1]: Session[1]: client_reset_config = false, Realm exists = true, async open = false, client reset = false
      > Connection[1]: Connected to endpoint '::1:9090' (from '::1:62498')
      > Connection[1]: Received: ERROR "sync is not enabled for this app" (error_code=101, try_again=0, session_ident=0)
      > Connection[1]: Connection closed due to error reported by server: sync is not enabled for this app (101)

      Actual Results

      The error is logged, but the promise returned by Realm.open neither resolves nor rejects.
      I speculate reason that the error callback isn't called might be because the error is not associated with a particular session.

      Steps to Reproduce

      1. Instantiate an App instance of a Realm App that doesn't have sync enabled.
      2. Try opening a Realm on that server (using new Realm or Realm.open) and notice how the error isn't thrown or logged (when a config.sync.error callback is provided).

      Code Sample

      Unable to find source-code formatter for language: typescript. 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
      new Realm({
        sync: {
          user: app.currentUser,
          partitionValue: "something",
          error: (session, error) => {
            console.error("err", error);
          },
        },
      });
      

      Version of Realm and Tooling

      • Realm JS SDK Version: v10.4.0
      • Node or React Native: Both
      • Client OS & Version: N/A
      • Which debugger for React Native: None

            Assignee:
            Unassigned Unassigned
            Reporter:
            kraen.hansen@mongodb.com Kræn Hansen
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: