Realm not using `baseUrl` in Realm.App() config

I am using the Realm Node SDK, and I’m having trouble getting Realm to use the baseUrl that I’m setting when initializing my Realm server:

...
// I initialize Realm as part of a class I made
constructor() {
    this.app = new Realm.App({ id: REALM_APP_ID, baseUrl: electronApp.getPath('userData') });
  }
...

Instead of placing the mongodb-realm directory in the baseUrl location, it puts it at the root of my project. No matter what value I put for baseUrl, no matter if I delete the old mongodb-realm folder, it always creates it in the same place.

I’m able to run my application just fine in development, and my app can connect to Realm, but my application is an Electron app, and when I package it up and try to run it, I get permission errors when Realm tries to create the directory /mongodb-realm (I think because it’s trying to do this at the root directory of my filesystem? Not sure). I’m hoping that if I can change the baseUrl this will fix the make_dir errors.

Any insight is much appreciated!

I was able to resolve this by changing my Electron app’s working directory just before running new Realm, found the solution here: Realm Not Working with Packaged Electron App - #2 by kraenhansen

This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.