Expo RN and ParseLiveQuery EventEmitter error
New Issue Checklist
- [ X] I am not disclosing a vulnerability.
- [ X] I am not just asking a question.
- [ X] I have searched through existing issues.
- [ X] I can reproduce the issue with the latest versions of Parse Server and the Parse JS SDK.
Issue Description
I updated a lot of dependencies in the last weeks and now I cannot get my application into a working state. The problem seems to be related to the React Native Parse Live Queries but I did not find anything that could help me to debug this in a good way. I did not change anything in the config regarding Parse however I think it is due to the latest updates.
Actual Outcome
Environment
Server
- Parse Server version: 6.2.0
Client
- Parse client version: 4.3.1
- React Native 0.73.2
- Expo 50
This is how my config is setup:
import Parse from "parse/react-native.js";
import AsyncStorage from "@react-native-async-storage/async-storage";
// Initialize Parse Backend Back4app
const parseConfig = {
applicationId: "...",
javascriptKey: "...",
serverURL: "...",
liveQueryServerURL: "...",
};
//Before using the SDK...
Parse.setAsyncStorage(AsyncStorage);
Parse.initialize(parseConfig.applicationId, parseConfig.javascriptKey);
Parse.serverURL = parseConfig.serverURL;
Parse.liveQueryServerURL = parseConfig.liveQueryServerURL;
// Enable cached user
Parse.User.enableUnsafeCurrentUser();
export default Parse;
And I do subscribe to the queries by:
parseQuerySub = await parseQuery.subscribe();
parseQuerySub.on("create", (myStuff: MyStuff) => {
do stuff
}
Thanks for opening this issue!
- 🚀 You can help us to fix this issue faster by opening a pull request with a failing test. See our Contribution Guide for how to make a pull request, or read our New Contributor's Guide if this is your first time contributing.
I'm closing as it does not seem to be a Parse JS SDK issue given the current information.
- For help with Parse Platform we recommend our community forum or our community chat
- For general coding questions we recommend Stack Overflow using the parse-platform tag
- For network and server questions we recommend ServerFault using the parse-server tag
Feel free to comment if you have any new information and we can re-open this issue.
Hi @mtrezza, clearly a Parse problem with expo. I have a spin up a new app using Ignite CLI and I don't use LiveQuery but just the fact of having Parse initialization I am having the exact error above. If I comment parse code no errors.
@andre-sonect Could you please add a detailed description of the issue and a sample code to reproduce this? The example from @manufunk seems to involve more code and LiveQuery, but it seems you could provide a more simple example? Also, which prior version of the Parse JS SDK works without issue and from which version onwards does the issue occur for you?
Hi @mtrezza, sure to be honest just create a new project using ignite cli and install parse. Then just initialize it on app.tsx and run it. It will show the error above. If you need an actual repo with the code I can also provide it.
I am having the exact same issue, but without Expo.
I have been using Parse 4.2.0 successfully with RN 0.72.5.
When I upgraded RN to 0.73.5 I started to get the same message and I cannot get past Parse.initialize. I don't even use LiveQuery and yet this is where I get the exception.
I have checked it in multiple configurations and I always get the same result.
Moreover, I went and directly commented out this line. After that, I was able to get past Parse.Initialize
So @Jakub-Plan-d-k you were able to use Parse 4.2.0 successfully with RN 0.72.5? No errors like the one above?
@andresteves that's right. However for 0.73.5 I had to update to Kotlin. I am not sure whether those issues are caused by switch to Kotlin or RN update itself. *By using Kotlin I mean in the MainApplication and MainActivity (+ReactNativeFlipper, which is gone in 0.73.5)
@Jakub-Plan-d-k it can also be a Typescript issue since from one version to the other the version went from 4.8.4 to 5.0.4 of Typescript and Parse types is written using "typeScriptVersion": "4.5". Not too sure if that can be the problem since I am not a expert on that.
@andresteves neither am I, but could be. There was something about react native types in the migration guide. Also I made a small mistake it was RN 0.72.6, I have just checked my repo. Anyway, you have a quick fix for local builds above, and hopefully this will get fixed soon, so we can use that also in external tools.
Can confirm that downgrading typescript to "typescript": "^4.8.4" works with latest Parse 4.2.0 and also RN 0.73.4.