Realm-js: How to prevent creating realm-object-server folder?

Created on 21 Aug 2017  路  16Comments  路  Source: realm/realm-js

When I launch my node app like node app.js everything is ok

When I'm trying to launch it like node /nodes/someapp/app.js it fails with error

terminate called after throwing an instance of 'realm::util::File::PermissionDenied'
what():  make_dir() failed: Permission denied

I guess that realm tries to create realm-object-server folder on every require('realm') right in ./ folder. So when I'm trying to launch my app from / realm tries to create that folder in /.

Looks like bug! Could you please fix it?

Version of Realm and Tooling

  • Realm JS SDK Version: 1.10.0
  • Node or React Nattive: NodeJS 8
  • Client OS & Version: Debian 9
  • Which debugger for React Native: None
Reproduction-Required T-Bug

All 16 comments

@MihaelIsaev Thanks for reporting.

Does this bug fixed?

@anysome We haven't been able to reproduce it.

@kneth Everything work fine in development. But the release version can't make dir for 'realm-object-server'.

2236 Fixed the problem, maybe it should be documented.

Yeah, documenting the work-around would be a good idea.

I can reproduce this when using realm in a serverless function like from firebase cloud functions.
In firebase cloud functions, the functions use a read-only file system and only have a /tmp directory that can be used for writing to disk space.

I've tried using process.chdir(/tmp) but still not overriding it.

This means I can't access a synced Realm from a firebase function 馃槩

@Eyesonly88 Do you get permission denied or a different error message?

@kneth I get permission denied.
Without being able to control where the realm-object-server folder is created, accessing a synced realm from a serverless function won't work (at least not in firebase cloud functions).

@Eyesonly88 You can try to set Realm.defaultPath.

^ I tried that. It only set the local realm path. The realm-object-server folder was still created and not in the defaultPath.

In what order do you process.chdir() and require('realm')?

@kneth I did process.chdir() first and then require('realm')

@Eyesonly88 Please create a new issue with code to reproduce the issue.

@Eyesonly88 Is the issue fixed now?

@mithunph nope, someone needs to create a new issue with repro steps apparently. I've changed my approach so don't need to do this anymore.

@mithunph did you find an easy workaround?
I am trying to use Realm.App({ id }) and app.login(credentials) in an AWS Lambda.
And I am getting an error message for make_dir()

Is there a way to avoid creating the directory?
I have set the directory using process.chdir('/tmp') but now I am getting a new error:
https://github.com/realm/realm-js/issues/1832

Was this page helpful?
0 / 5 - 0 ratings

Related issues

max-zu picture max-zu  路  3Comments

camslaz picture camslaz  路  4Comments

ashah888 picture ashah888  路  3Comments

jmartindivmedianet picture jmartindivmedianet  路  3Comments

timanglade picture timanglade  路  3Comments