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

🔥 ServerTimestamp isn't working with arrayUnion #1831

Closed
5 of 28 tasks
manicantic opened this issue Jan 14, 2019 · 8 comments
Closed
5 of 28 tasks

🔥 ServerTimestamp isn't working with arrayUnion #1831

manicantic opened this issue Jan 14, 2019 · 8 comments

Comments

@manicantic
Copy link

manicantic commented Jan 14, 2019

Issue

FieldValue serverTimestamp inside arrayUnion isn't working. Outside arrayUnion everything works fine.
await messageRef.update({array: firebase.firestore.FieldValue.arrayUnion({ message, timestamp: firebase.firestore.FieldValue.serverTimestamp(), senderId }) })

slika

Also, on version 5.2.0 same code reproduce this :

slika1


Environment

  • Platform that you're experiencing the issue on:
    • iOS
    • Android
    • iOS but have not tested behavior on Android
    • Android but have not tested behavior on iOS
    • Both
  • If known, the version of the platform are you experiencing the issue on:
    • API 27
  • Operating System:
    • MacOS, version: N/A
    • Windows, version: Windows_NT x64 10.0.17134
    • Other, please specify: N/A
  • Build Tools:
    • Android Studio 3.1.4
  • React Native version:
    • 0.57.8
  • React Native Firebase library version:
    • 5.1.1
  • Firebase module(s) you're using that has the issue:
    • Authentication
    • Analytics
    • Cloud Firestore
    • Cloud Messaging (FCM)
    • Crashlytics
    • Dynamic Links
    • Functions Callable
    • Invites
    • Instance ID
    • Notifications
    • Performance Monitoring
    • Realtime Database
    • Remote Config
    • Storage
  • Are you using TypeScript?
    • No
    • Yes, version: N/A
  • Are you using Expo, e.g. ExpoKit?
    • No
    • Yes, I've not ejected
    • Yes, but I have ejected to ExpoKit
    • Yes, but I have ejected to vanilla React Native
    • Expo version: N/A
@manicantic manicantic changed the title 🔥 ServerTimestamp isn't working with arrayUnion 🔥 ServerTimestamp isn't working with arrayUnion Jan 14, 2019
@Salakar
Copy link
Member

Salakar commented Jan 14, 2019

Hey @manicantic this was resolved in v5.2.0, please could you upgrade, thanks.

Changelog & upgrade guide here: https://rnfirebase.io/docs/v5.x.x/releases/v5.2.0

@Salakar Salakar closed this as completed Jan 14, 2019
@manicantic
Copy link
Author

Hey @Salakar , I tried 5.2.0 and still got an error. If I have update with arrayUnion and serverTimestamp with transaction app instantly crashes ( code : await transaction.update(messageRef, { array: firebase .firestore .FieldValue .arrayUnion({ message, timestamp: firebase .firestore .FieldValue .serverTimestamp(), senderId }) }) ) ), and if update wihtout transaction I get this error :
screenshot_2019-01-14-22-58-49 Code for this : await messageRef.update({ array: firebase .firestore .FieldValue .arrayUnion({ message, timestamp: firebase .firestore .FieldValue .serverTimestamp(), senderId }) }) .
And first time I updated to 5.2.0 ( while I was writing this issue ) I updated document and firestore looked like this:

Also my app level build.gradle details :
implementation "com.google.firebase:firebase-core:16.0.6" implementation "com.google.firebase:firebase-auth:16.1.0" implementation "com.google.firebase:firebase-firestore:17.1.5"

@Salakar
Copy link
Member

Salakar commented Jan 14, 2019

@manicantic hey, sorry I forgot to mention, the fix for v5.2.0 means that data gets passed correctly to Firestore - now that it's correctly passed it will give you that Error as this is the correct behaviour, none of the Firebase SDKs support serverTimestamp in arrayUnion/remove yet. E.g.: firebase/firebase-admin-node#336

References and other values work fine.

@julienreszka
Copy link

@Salakar "none of the Firebase SDKs support serverTimestamp in arrayUnion/remove yet"

"YET", does that mean that it will be supported eventually?

@edwardoverthere
Copy link

Not supported yet unfortunately!

@Asanta4
Copy link

Asanta4 commented Jul 13, 2024

still not supported yet unfortunately

@jdboris
Copy link

jdboris commented Jul 21, 2024

so is there a workaround? How do I add a server timestamp to an array?

@JasonBennett41
Copy link

JasonBennett41 commented Aug 29, 2024

I find it absolutely ridiculous that there is no mention of this in the documentation... what a frustrating afternoon. This issue resulted in app crash with no error msg for me in Flutter. It would take one person half a day to update the docs/SDKs to save thousands of collective hours of wasted time...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants