-
Notifications
You must be signed in to change notification settings - Fork 4k
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] DocumentReference in startAfterDocument snapshot causes crash (invalid encode argument) #2044
Comments
Hey @creativecreatorormaybenot, can you share what your |
@ditman I have this debug log, which should be the exact same query (apart from the limit, but that value varies). Let me know if I should provide it in a different format. Regarding the snapshot, I guess the most useful input here would be sharing the data types. The documents that are queried consist of: Field types
Some occur multiple times, e.g. multiple This is for sure due to |
Yes, this is probably related to the document passed to |
@ditman Oh, I know why. Sorry for not thinking carefully. The reason why it happens only sometimes is that the documents in the query mostly have the document reference field as Every time a document has a |
Ah, cool, that makes sense! I'll take a look ASAP, if @amrfarid140 doesn't get to this before I do! |
``` I/flutter ( 4164): 00:07 +9: Firestore pagination with DocumentReference (firebase#2044) [E] I/flutter ( 4164): Invalid argument: Instance of 'DocumentReference' I/flutter ( 4164): package:flutter/src/services/message_codecs.dart 392:7 StandardMessageCodec.writeValue I/flutter ( 4164): package:cloud_firestore_platform_interface/src/method_channel/utils/firestore_message_codec.dart 83:13 FirestoreMessageCodec.writeValue I/flutter ( 4164): package:flutter/src/services/message_codecs.dart 389:9 StandardMessageCodec.writeValue.<fn> I/flutter ( 4164): dart:collection-patch/compact_hash.dart 379:8 _LinkedHashMapMixin.forEach I/flutter ( 4164): package:flutter/src/services/message_codecs.dart 387:13 StandardMessageCodec.writeValue I/flutter ( 4164): package:cloud_firestore_platform_interface/src/method_channel/utils/firestore_message_codec.dart 83:13 FirestoreMessageCodec.writeValue ```
The issue seems to originate in _PlatformUtils::toPlatformDocumentSnapshot. It's using the The fix is to either pass I'm leaning towards the latter, which may waste a few cycles (and on big documents it might be a bunch) converting back and forth the data of the document snapshot, but it doesn't access private fields (which makes it harder to refactor the library as |
Nope. The Firestore pagination integ test is broken in web in
|
My new test requires an index to be created. I'm waiting to be added to the Integ test project so I can create said index and continue on this. |
@ditman How come that this was not caught in CI? I could write tests to catch the error described in this issue if that helps. |
I'm facing the exact same issue. Downgrading to |
I'm going to push a fix for most of the issues I've found while investigating this (and fixing tests) today. I'll investigate the Timestamp issue next. |
Tagged and published:
DocumentReferences with DocumentReferences in startAfterDocument should work as expected now! Please clear your pub caches and grab the latest versions, and let us know how it goes! |
@ditman Works 🙂 Thank you so much 👍 |
Sweet, thanks for reporting @creativecreatorormaybenot! |
not working, timestamp issue - |
@kushvatsa can you cut a separate issue for that? Thanks! |
@amrfarid140 @ditman I think I have found another one of the
.valueEncode
issues as discussed here. See also: #1986.The error I get is
Invalid argument: Instance of 'DocumentReference'
.Full stack trace
Setup
The error happens every time a document has a
DocumentReference
as a value for a field and the snapshot is passed tostartAfterDocument
with this line (thegetDocuments
call causes it):This was recently introduced with
0.13.0
. I am currently usingcloud_firestore
version0.13.3
.The text was updated successfully, but these errors were encountered: