node does not exit if realm-js is imported
See original GitHub issueGoals
Use realm in a cli program.
Expected Results
The program does its job and exits.
Actual Results
Node does not exit.
Steps to Reproduce
- Import realm-js
Code Sample
require('realm');
console.log('hello');
It prints hello and hangs.
Version of Realm and Tooling
- Realm JS SDK Version: the issue first appeared in
1.12.0 - Node or React Native: Node 6.11.3
- Client OS & Version: macOS 10.12.6 and Debian 8
Issue Analytics
- State:
- Created 6 years ago
- Reactions:4
- Comments:18 (8 by maintainers)
Top Results From Across the Web
Realm-js: Cannot access realm that has been closed
Realm keeps throwing this error in a simple use case: Cannot access realm that has been closed. My files: RealmExample.js import Realm from ......
Read more >realm - npm
Realm is a mobile database that runs directly inside phones, tablets or wearables. This project hosts the JavaScript versions of Realm.
Read more >Troubleshooting - React Native
If running on device from Xcode, you can do this by updating occurrences of 8081 to your chosen port in the ios/__App_Name__.xcodeproj/project.
Read more >Example of Realm Database in React Native
Note: Realm library does not support node version 10 yet so if you want to use this ... Install react-navigation dependency to import...
Read more >Getting Started - ESBuild
The recommended way to install esbuild is to install the native executable using npm. But if you don't want to do that, there...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

Any news on this one ? I can reproduce the described behavior with realm-js 2.3.1 and my jest tests won’t terminate without adding the --forceExit hack.
This also prevents jest from exiting after finishing all tests.
Now this is a major annoyance as it prevents us from running tests agains in memory realms (or importing realm at all in our tests).I created a demo project to demonstrate the issue: https://github.com/stigi/realm-require-issue
Edit: The workaround for jest is, running jest with the
--forceExitflag. This triggersprocess.exitwhen all tests have been run.