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

[cloud_firestore] crashes if you insert "/" char into .document(value) [only iOS] #2338

Closed
mustafarenkci opened this issue Apr 9, 2020 · 6 comments
Labels
impact: customer A bug with low impact (e.g. affecting only a few customers or has a workaround). (P3) plugin: cloud_firestore type: bug Something isn't working

Comments

@mustafarenkci
Copy link

mustafarenkci commented Apr 9, 2020

Describe the bug
im using firestore and it works well but when i try to use a string which contains "/" char into document(), app crashes ONLY ON iOS DEVICES.

For example;

DocumentReference fireStoreReference =
        Firestore.instance.collection('liked').document("xyz**/**xyz");
await fireStoreReference.get().then((DocumentSnapshot ds) async {
***
});

At runtime, the following crash occurs, closing the app (it is not handled by Flutter):

*** First throw call stack:
(
	0   CoreFoundation                      0x00007fff23e3dcce __exceptionPreprocess + 350
	1   libobjc.A.dylib                     0x00007fff50b3b9b2 objc_exception_throw + 48
	2   CoreFoundation                      0x00007fff23e3da48 +[NSException raise:format:arguments:] + 88
	3   Foundation                          0x00007fff258ac85b -[NSAssertionHandler handleFailureInFunction:file:lineNumber:description:] + 166
	4   Runner                              0x0000000103b51d77 _ZN8firebase9firestore4util16ObjcThrowHandlerENS1_13ExceptionTypeEPKcS4_iRKNSt3__112basic_stringIcNS5_11char_traitsIcEENS5_9allocatorIcEEEE + 343
	5   Runner                              0x00000001

im using cloud_firestore: ^0.13.4+2

@mustafarenkci mustafarenkci added the type: bug Something isn't working label Apr 9, 2020
@mustafarenkci mustafarenkci changed the title [cloud_firestore] crashes if you insert "/" char into .document(value) [cloud_firestore] crashes if you insert "/" char into .document(value) [only iOS] Apr 10, 2020
@TahaTesser
Copy link

TahaTesser commented Apr 14, 2020

Hi @mustafarenkci
can you please provide your flutter doctor -v and flutter run --verbose?
Thank you

@TahaTesser TahaTesser added the blocked: customer-response Waiting for customer response, e.g. more information was requested. label Apr 14, 2020
@mustafarenkci
Copy link
Author

Hi @mustafarenkci
can you please provide your flutter doctor -v and flutter run --verbose?
Thank you

Here;

Flutter doctor -v

[✓] Flutter (Channel stable, v1.12.13+hotfix.9, on Mac OS X 10.15.4 19E287, locale tr-TR)
    • Flutter version 1.12.13+hotfix.9 at /Users/mustafarenkci/Documents/flutter
    • Framework revision f139b11009 (2 weeks ago), 2020-03-30 13:57:30 -0700
    • Engine revision af51afceb8
    • Dart version 2.7.2


[✓] Android toolchain - develop for Android devices (Android SDK version 28.0.3)
    • Android SDK at /Users/mustafarenkci/Library/Android/sdk
    • Android NDK location not configured (optional; useful for native profiling support)
    • Platform android-29, build-tools 28.0.3
    • ANDROID_HOME = /Users/mustafarenkci/Library/Android/sdk
    • Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 1.8.0_212-release-1586-b4-5784211)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 11.4)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Xcode 11.4, Build version 11E146
    • CocoaPods version 1.9.1

[✓] Android Studio (version 3.6)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin version 45.1.1
    • Dart plugin version 192.7761
    • Java version OpenJDK Runtime Environment (build 1.8.0_212-release-1586-b4-5784211)

[✓] Connected device (1 available)
    • iPhone 8 • 6090B51F-8963-4F09-8FF8-CA3DE8DA2521 • ios • com.apple.CoreSimulator.SimRuntime.iOS-13-4 (simulator)

• No issues found!

flutter run --verbose

[  +12 ms] [DEVICE LOG] 2020-04-15 02:08:52.846210+0300  localhost Runner[15946]: (Foundation) *** Assertion failure in
firebase::firestore::api::DocumentReference::DocumentReference(model::ResourcePath, std::shared_ptr<Firestore>)(),
/Users/mustafarenkci/Documents/FlutterProjects/fetvasor/ios/Pods/FirebaseFirestore/Firestore/core/src/firebase/firestore/api/document_reference.cc:67
[  +63 ms] Service protocol connection closed.
[        ] Lost connection to device.
[   +1 ms] DevFS: Deleting filesystem on the device
(file:///Users/mustafarenkci/Library/Developer/CoreSimulator/Devices/6090B51F-8963-4F09-8FF8-CA3DE8DA2521/data/Containers/Data/Application/E62318B1-B7FC-49CD-9F97-210DE1EA0DA5/tmp/fetvasorjvQZNv/fet
vasor/)
[        ] Sending to VM service: _deleteDevFS({fsName: fetvasor})
[        ] [DEVICE LOG] 2020-04-15 02:08:52.903145+0300  localhost Runner[15946]: (CoreFoundation) *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason:
'FIRESTORE INTERNAL ASSERTION FAILED: Invalid document reference. Document references must have an even number of segments, but liked/Abdesti bozan/bozmayan durumlarda farklı mezhepten imam ve
cemaatin durumu has 3'
[        ] [DEVICE LOG] *** First throw call stack:
[        ] [DEVICE LOG] (
[        ] [DEVICE LOG]         0   CoreFoundation                      0x00007fff23e3dcce __exceptionPreprocess + 350
[        ] [DEVICE LOG]         1   libobjc.A.dylib                     0x00007fff50b3b9b2 objc_exception_throw + 48
[        ] [DEVICE LOG]         2   CoreFoundation                      0x00007fff23e3da48 +[NSException raise:format:arguments:] + 88
[        ] [DEVICE LOG]         3   Foundation                          0x00007fff258ac85b -[NSAssertionHandler handleFailureInFunction:file:lineNumber:description:] + 166
[        ] [DEVICE LOG]         4   Runner                              0x0000000103943d67
_ZN8firebase9firestore4util16ObjcThrowHandlerENS1_13ExceptionTypeEPKcS4_iRKNSt3__112basic_stringIcNS5_11char_traitsIcEENS5_9allocatorIcEEEE + 343
[        ] [DEVICE LOG]         5   Runner                              0x00000001
[        ] *** First throw call stack:
[        ] (
[        ]      0   CoreFoundation                      0x00007fff23e3dcce __exceptionPreprocess + 350
[        ]      1   libobjc.A.dylib                     0x00007fff50b3b9b2 objc_exception_throw + 48
[        ]      2   CoreFoundation                      0x00007fff23e3da48 +[NSException raise:format:arguments:] + 88
[        ]      3   Foundation                          0x00007fff258ac85b -[NSAssertionHandler handleFailureInFunction:file:lineNumber:description:] + 166
[        ]      4   Runner                              0x0000000103943d67
_ZN8firebase9firestore4util16ObjcThrowHandlerENS1_13ExceptionTypeEPKcS4_iRKNSt3__112basic_stringIcNS5_11char_traitsIcEENS5_9allocatorIcEEEE + 343
[        ]      5   Runner                              0x00000001
[ +252 ms] Ignored error while cleaning up DevFS: TimeoutException after 0:00:00.250000: Future not completed
[   +3 ms] "flutter run" took 398.786ms.

@TahaTesser TahaTesser removed the blocked: customer-response Waiting for customer response, e.g. more information was requested. label Apr 15, 2020
@Ehesp
Copy link
Member

Ehesp commented Apr 18, 2020

.collection('liked').document("xyz**/**xyz");

A pointer to a document must be an event amount of segments so the error is correct. What happens on Android?

Collection/Document names cannot include / characters.

@Ehesp Ehesp added plugin: cloud_firestore impact: customer A bug with low impact (e.g. affecting only a few customers or has a workaround). (P3) labels Apr 18, 2020
@onikiri2007
Copy link

I'm getting the same issue. Previous version used to work with the above format even on iOS. On Android, it works as expected.

@Ehesp
Copy link
Member

Ehesp commented Jul 1, 2020

On JS, that code produces this error:

FirebaseError: Invalid document reference. Document references must have an even number of segments, but liked/xyz/xyz has 3

This will be caught but the correct behaviour is to throw an error.

@Salakar
Copy link
Member

Salakar commented Jul 7, 2020

Hey all, as part of our on-going work for #2582, this has been resolved in our Firebase Firestore rework (#2913) - which has now been merged into master. We'll look at publishing some prereleases in the next few days. Thank you

@Salakar Salakar closed this as completed Jul 7, 2020
@firebase firebase locked and limited conversation to collaborators Aug 7, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
impact: customer A bug with low impact (e.g. affecting only a few customers or has a workaround). (P3) plugin: cloud_firestore type: bug Something isn't working
Projects
None yet
Development

No branches or pull requests

5 participants