Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

App crashes on fetching a collection which contains field as 'Reference Type' #617

Closed
VenkatramanRajagopalan opened this issue Apr 18, 2021 · 0 comments
Labels
android Relates to Android platform bug Something isn't working properly Firestore Related to Firebase Firestore Realtime Database ios relates to iOS platform runtime issue An issue related to app runtime

Comments

@VenkatramanRajagopalan
Copy link

Bug report

Current behavior:
When trying to fetch documents(containing 'ReferenceType' fields) using the fetchFirestoreCollection() method, app crashes. The logcat shows StackOverflow error on trying to convert the object from gson.toJson() line

Expected behavior:
Either the Document Reference should be fetched from the firebase in circular fashion or the reference path has to be sent to the app

Steps to reproduce:
In firebase Firestore database, create a new document with a reference type field. Fetch the document using the fetchFirestoreCollection() method

Screenshots
Example reference field in a firestore document
Screenshot (65)

Environment information

Ionic:

Ionic CLI : 6.13.1 (C:\Users\venkat\AppData\Roaming\npm\node_modules@ionic\cli)
Ionic Framework : @ionic/angular 5.5.5
@angular-devkit/build-angular : 0.1100.7
@angular-devkit/schematics : 11.0.7
@angular/cli : 11.0.7
@ionic/angular-toolkit : 3.1.0

Cordova:

Cordova CLI : 10.0.0
Cordova Platforms : android 9.0.0
Cordova Plugins : cordova-plugin-ionic-keyboard 2.2.0, cordova-plugin-ionic-webview 4.2.1, (and 5 other plugins)

Utility:

cordova-res : 0.15.3
native-run : 1.3.0

System:

Android SDK Tools : 26.1.1 (C:\Users\venkat\AppData\Local\Android\Sdk)
NodeJS : v14.15.5 (C:\Program Files\nodejs\node.exe)
npm : 6.14.11
OS : Windows 10

Runtime issue

  • Device details
    • OnePlus 7
  • OS details
    • Android 10

Related code:
Code used to fetch the collection

this.firestore.fetchFirestoreCollection(collectionName, [], resolve, reject)

Console output

console output

java.lang.StackOverflowError: stack size 8192KB
at org.apache.cordova.firebase.FirebasePlugin.mapToJsonObject(FirebasePlugin.java:2767)
        at org.apache.cordova.firebase.FirebasePlugin.access$3200(FirebasePlugin.java:105)
        at org.apache.cordova.firebase.FirebasePlugin$73$1.onComplete(FirebasePlugin.java:2310)



Other information:
The same collection works without the reference field. It crashes only when the reference field is added.

Thanks in advance.

dpa99c pushed a commit that referenced this issue Jun 16, 2021
…data from Firestore to avoid crashes due to circular references.

Fixes #617.
@dpa99c dpa99c added android Relates to Android platform bug Something isn't working properly Firestore Related to Firebase Firestore Realtime Database ios relates to iOS platform ready for release Something has been implemented and is awaiting release to npm runtime issue An issue related to app runtime labels Jun 16, 2021
dpa99c added a commit that referenced this issue Jun 16, 2021
…om Firestore to avoid crashes due to circular references.

Fixes #617.
@dpa99c dpa99c closed this as completed in b500935 Jun 16, 2021
@dpa99c dpa99c removed the ready for release Something has been implemented and is awaiting release to npm label Jun 16, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
android Relates to Android platform bug Something isn't working properly Firestore Related to Firebase Firestore Realtime Database ios relates to iOS platform runtime issue An issue related to app runtime
Projects
None yet
Development

No branches or pull requests

2 participants