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?
@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'.
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