You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
At first I thought it was Firestore throwing the exception as Firestore always recommended to use FIRTimestamps as Date objects will no longer be supported and might break in future releases. With this initial thought, I went ahead and updated my Model objects to start using FIRTimestamps. You might wonder why I updated my model objects? I have made my Model objects Codable with the help of a pod called https://github.com/alickbass/CodableFirebase to make it convenient to directly using structs or classes with Firestore, it worked with CloudFunctions as well. After using FIRTimestamp I got the same exception with unsupported type FIRTimestamp.
'FIRInvalidArgumentException', reason: 'Unsupported type: FIRTimestamp for value FIRTimestamp: seconds=1535053882 nanoseconds=638557910>'
Right now I'm stuck between having to rewrite all my CloudFunction dictionaries manually or write a method that makes sure FIRTimestamps are passed as String Date values or as milliseconds. This makes it very inconvenient to have conflicting requirements with both Google products.
Edit:
Realized NSDate was never supported to begin with. I broke my project by adding a date to the object and requiring it. Nevertheless, this is still a problematic issue.
Steps to reproduce:
Pass a Date object or FIRTimestamp object in the dictionary to a CloudFunction
The text was updated successfully, but these errors were encountered:
serjooo
changed the title
[FR] [ISSUE] Cloud Function does not support FIRTimestamps (Supoort FIRTimestamps / Support Dates again)
[FR] [ISSUE] Cloud Function does not support FIRTimestamps (Support FIRTimestamps / Support Dates again)
Aug 24, 2018
Hi @serjooo. You are correct that NSDate/FIRTimestamp are not yet supported by Cloud Functions. Thank you for letting us know how this functionality would be useful to you. We are still considering how best to support this particular use case, and may add such functionality in the future.
Use selects a date in the app. This fires a HTTPs.onCall for an API call to Google Calendar, with a min/max time set for that date, to get all events for that date. Would be nice to be able to upload the Date/Timestamp directly from the client.
Workaround right now is to upload a string for the selected day, and then create the date in javascript from the string reference.
Uh oh!
There was an error while loading. Please reload this page.
Environment
The problem
As I was calling a Cloud Function I received a fatal error saying:
'FIRInvalidArgumentException', reason: 'Unsupported type: NSDate
At first I thought it was Firestore throwing the exception as Firestore always recommended to use
FIRTimestamps
asDate
objects will no longer be supported and might break in future releases. With this initial thought, I went ahead and updated my Model objects to start usingFIRTimestamps
. You might wonder why I updated my model objects? I have made my Model objectsCodable
with the help of a pod called https://github.com/alickbass/CodableFirebase to make it convenient to directly using structs or classes with Firestore, it worked with CloudFunctions as well. After using FIRTimestamp I got the same exception with unsupported type FIRTimestamp.'FIRInvalidArgumentException', reason: 'Unsupported type: FIRTimestamp for value FIRTimestamp: seconds=1535053882 nanoseconds=638557910>'
Right now I'm stuck between having to rewrite all my CloudFunction dictionaries manually or write a method that makes sure FIRTimestamps are passed as String Date values or as milliseconds. This makes it very inconvenient to have conflicting requirements with both Google products.
Edit:
Realized
NSDate
was never supported to begin with. I broke my project by adding a date to the object and requiring it. Nevertheless, this is still a problematic issue.Steps to reproduce:
Pass a
Date
object orFIRTimestamp
object in the dictionary to a CloudFunctionThe text was updated successfully, but these errors were encountered: