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

Starting from version 12 it is not possible to override the fetch API used by SDK

      How frequently does the bug occur?

      Always

      Description

      Previously Node.js SDK was using @realm/network-transport package as a provider of fetch API and it was possible to override it and use e.g. window.fetch API when running in an Electron renderer process. But starting from version 12.0 the SDK seems to use node-fetch exclusively without an option to override it.
      The option to use custom fetch API was important because it allowed to control SSL validation for network operations performed by SDK, for example usage of window.fetch in an Electron renderer allows to trust certificates added to the system certificate store.

      I see there is an option to define a custom function for SSL validation in Sync configuration which is a good feature that could add to flexibility, however there seems to be no way to control SSL validation for requests sent by SDK to log user in. This defeats the purpose of SSL settings in the sync configuration because the SSL validation issues it should help to resolve will prevent app from getting a user session needed to sync data down.

      Stacktrace & log output

      No response

      Can you reproduce the bug?

      Always

      Reproduction Steps

      1. Run Realm in Electron, in a renderer process with node integration.
      2. Try to inject window.fetch API into realm SDK in order to trust custom certificates from the system store.

      Version

      12.1.0

      What services are you using?

      Both Atlas Device Sync and Atlas App Services

      Are you using encryption?

      No

      Platform OS and version(s)

      Windows 10, Debian 11

      Build environment

      No response

      Cocoapods version

      No response

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

              Created:
              Updated: