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

Expo RN and ParseLiveQuery EventEmitter error

Open manufunk opened this issue 1 year ago • 12 comments

New Issue Checklist

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

Screenshot 2024-02-04 at 15 50 55

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
}

manufunk avatar Feb 04 '24 15:02 manufunk

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.

Feel free to comment if you have any new information and we can re-open this issue.

mtrezza avatar Feb 06 '24 12:02 mtrezza

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 avatar Feb 28 '24 20:02 andre-sonect

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

mtrezza avatar Feb 29 '24 08:02 mtrezza

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.

andresteves avatar Feb 29 '24 10:02 andresteves

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. image

Jakub-Plan-d-k avatar Mar 07 '24 09:03 Jakub-Plan-d-k

Moreover, I went and directly commented out this line. After that, I was able to get past Parse.Initialize

image

Jakub-Plan-d-k avatar Mar 07 '24 09:03 Jakub-Plan-d-k

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 avatar Mar 07 '24 10:03 andresteves

@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 avatar Mar 07 '24 10:03 Jakub-Plan-d-k

@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 avatar Mar 07 '24 10:03 andresteves

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

Jakub-Plan-d-k avatar Mar 07 '24 10:03 Jakub-Plan-d-k

Can confirm that downgrading typescript to "typescript": "^4.8.4" works with latest Parse 4.2.0 and also RN 0.73.4.

andresteves avatar Mar 07 '24 10:03 andresteves