I would like realm to work normally while not connected to a remote debugger.
While attached to a debugger, realm works as expected. When it is not attached, nothing is saved to realm. I am also having a hard time debugging this issue because, as noted, it doesn't happen while attached to a debugger.
Note: I have followed the steps described in the documentation for how to handle this error. I have also looked at other issues and haven't seen anything related to the debugger being active/inactive.
I'm not sure how to reproduce this for everybody but it is consistently reproducible for me by:
1) turning on the debugger and seeing that realm works normally
2) turn on the debugger and see that realm is not storing or retrieving any results
3) turn debugger back on and works as expected
https://github.com/Kdoherty11/realm-test
@Kdoherty11 Thanks for reporting. Did you try to react-native link realm as suggested in https://realm.io/docs/javascript/latest/#missing-realm-constructor?
@kneth Yes I have. I have also followed the steps described there multiple times which include closing everything and deleting the build folder. Please let me know how I can help move this forward as it is a blocker for me right now.
Also, I'm not sure if it's relevant but I am using pods in this project.
@kneth I created a new project/repo and was able to reproduce the issue. I also created a youtube video showing the problem.
Git Repo:
https://github.com/Kdoherty11/realm-test
Issue Demo:
https://youtu.be/0NImX4RWXDM
I found the issue. Object.values(results) always returns [] when not attached to a debugger. If replaced with Object.keys(results).map(key => deserialize(results[key])) it works as expected.
@Kdoherty11 Thanks for the effort, you have put into it. We have issue with the debugger so I would have assume that you would have been the opposite effect.
@Kdoherty11 thanks for the test code. Could you try and see if the problem is reproducible on an Android emulator (without your Object.values fix)?
A search of node_modules/realm (1.12.0) for Object.values(results)` returns 0 matches. @Kdoherty11, where in the code did you make this change?
@kneth @ashwinphatak any updates on this issue? We are continuing to see high numbers of prod users impacted by this issue - over 100 so far. Are there plans to release a 1.13.0 in the near future which address RN 0.48 + dev port assignment issue, + Error: Missing Realm constructor. Did you run "react-native link realm"?
@TGPSKI I am planning to do a release sometimes next week.
Is it possible to resolve this issue temporary?
What about iOS?
@NavaneeBaskaran: This issue only shows itself for iOS users from my side. Has to be a core Realm issue, not related to the build toolchain
@kneth: any updates on the release date? We have iOS and Android binary releases pending bundling the realm update. Would love to take our crash rate down a few % as a result of removing the constructor issue.
I'm having this problem too, if I fix this before @kneth does, would you guys give me an interview? =D
Apparently @Kdoherty11 has some kind of solution, but I haven't figured out where to put this code change yet.
@kneth Still targeting end of week for a release? I'm continuing to hold iOS + Android binary releases back until this fix is released!
@Mellemel : where are you looking into fixing this? I don't mind poking around as well. This is a pretty critical issue for us - hundreds of users.
Sorry for the delay...
@TGPSKI Missing Realm constructor did not turn out to be the cause of my actual issue. I was experiencing unexpected behavior (described above) and the missing constructor error was the only realm related crash showing up in my crash reported so I falsely suspected they were related. I updated the issue title to reflect this. Also, the Object.values was a reference to this line https://github.com/Kdoherty11/realm-test/blob/87b341eb653fc2f90ab041be4fdea5a63d471204/realm/daos/dog.js#L13 not any realm code.
I'm sorry to say the missing constructor issue was fixed for me by exactly following the recommended instructions from https://realm.io/docs/javascript/latest/#troubleshooting several times. Just running react-native link was not enough.
@kneth Using my sample repo, I was not able to reproduce the issue on Android.
@Kdoherty11 Great to hear
@TGPSKI We have just released 1.13.0.
@TGPSKI I just switched
$(SRCROOT)/../../../../Pods/Headers/Public
to
$(SRCROOT)/../../../../ios/Pods/Headers/Public
in the RealmReact.xcodeproj header search paths and it did the trick for me.
@kneth @Mellemel @Kdoherty11 Thank you for the responses & information!!! Getting ready to release binaries right now.
@TGPSKI Great to hear. I am closing the issue!
?
I faced this issue with version 2.29.2: Object.values returns [] if called for Realm object.
Is is issue fixed in later versions? I did not find any reference in the changelog.
@Jarzka I suggest you test the latest version. Object.values will not work this is documented in the CHANGELOG.md
Realm Objects now have keys and entries methods that you can use like so:
obj = realm.create(...);
let keys = obj.keys();