Parse-SDK-JS icon indicating copy to clipboard operation
Parse-SDK-JS copied to clipboard

Parse SDK 4.3.1 is not working with React Native / Expo

Open pdesign opened this issue 1 year ago • 4 comments

When i try to use Parse SDK with the examples shown in their documentation. But it keeps giving this error...

TypeError: Cannot convert undefined value to object, js engine: hermes

I think none of 4+ versions of SDK works... 3.4.0 version seems to work... but its pretty old...

also you can not import parse/react-native.js as shown in the example / documentation...

you need to place the full path, otherwise it does not seem to work too... You need to import like you see below

import Parse from './node_modules/parse/react-native.js';

pdesign avatar Jan 27 '24 15:01 pdesign

Thanks for opening this issue!

Any update on this? Parse 3.4 is working.

chellay27 avatar Feb 20 '24 08:02 chellay27

I get the same error. Any update?

maciej-czekala avatar Feb 26 '24 12:02 maciej-czekala

I'm using 4.1 with React Native. I'm not using the react native version but the normal browser one. For React Native version just make sure you have the async storage installed (https://reactnative.dev/docs/asyncstorage). It is not a built-in feature of RN anymore. That might be the issue.

To use the browser version, you need a sync storage. I use MMKV (https://github.com/mrousavy/react-native-mmkv) and just built a small localstorage "polyfill" using it. Works great and I just import * as Parse from 'parse'; as you normally would.

mortenmo avatar Mar 16 '24 13:03 mortenmo

I tried to debug this problem including using different EventEmitter implementations. I could not get it to work. The problem is related to PR https://github.com/parse-community/Parse-SDK-JS/pull/1999. Locally I started from the current release branch, reverted the merge of this PR and got working LiveQuery connections again in my React Native project. I pushed my changes to https://github.com/martinpfannemueller/Parse-SDK-JS/tree/release.

The problem with this PR seems to be that the EventEmitters are not properly initialized when they are used. Hence, the registry objects inside the used emitter was undefined.

During my debugging I could see that this issue is also related to https://github.com/parse-community/Parse-SDK-JS/issues/2082.

martinpfannemueller avatar Apr 13 '24 13:04 martinpfannemueller

@martinpfannemueller I opened a PR to address this issue. https://github.com/parse-community/Parse-SDK-JS/pull/2109 Can you try it out in your project and let me know if it works for you?

dplewis avatar Apr 13 '24 23:04 dplewis

@dplewis I just tested your updated code. The live query connection is working fine again for me. Thanks for the quick fix!

martinpfannemueller avatar Apr 14 '24 07:04 martinpfannemueller

@martinpfannemueller No problem! Thank you for testing and debugging.

dplewis avatar Apr 14 '24 16:04 dplewis

Completed by https://github.com/parse-community/Parse-SDK-JS/pull/2109

dplewis avatar Apr 15 '24 16:04 dplewis