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

Strange console.warn when calling createConfiguration on a User

    • Type: Icon: Bug Bug
    • Resolution: Gone away
    • Priority: Icon: Unknown Unknown
    • None
    • Affects Version/s: None
    • Component/s: None

      Goals

      Realm JS is logging a warning with the message 'user' property will be overridden by ${this.identity} when the user calls createConfiguration on a Realm.Sync.User with a partial configuration object with a sync key. This happens even if the sync object does not have a user key - which I consider a bug.

      Generally it is often annoying when a library uses the console to log messages, warnings or errors because it can be very hard to figure out is triggering the message to be logged - throwing an error is often much more helpful, as it contains a stack-trace. If the console is used, we need to be very explicit about what method triggered the console.

      Expected Results

      Specifically - don't warn if the sync object i the partial configuration do not provide a user key or throw instead to make it easier for a user to debug this behaviour.

      Generally don't use console.log, console.warn and console.errors.

      Actual Results

      At https://github.com/realm/realm-js/blob/v2.14.2/lib/user-methods.js#L529

      Steps to Reproduce

      1. Create a Realm.Sync.User object.
      2. Call user.createConfiguration({ sync: {} });
      3. See "'user' property will be overridden by fd33cffb96e371d207d8e4a03f6c1434" being logged to the console.

      Code Sample

      const user = await Realm.Sync.User.registerWithProvider(url, {
        provider: "nickname",
        providerToken: nickname,
      });
      user.createConfiguration({ sync: {} })
      

      Version of Realm and Tooling

      • Realm JS SDK Version: 2.14.2
      • Node or React Native: Node
      • Client OS & Version: N/A
      • Which debugger for React Native: N/A

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

              Created:
              Updated:
              Resolved: