-
Notifications
You must be signed in to change notification settings - Fork 926
Date handling in functions serializer #683
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
Comments
Hey there! I couldn't figure out what this issue is about, so I've labeled it for a human to triage. Hang tight. |
Dealing with the same issue. Ive had to implement my own serialize/deserialize shim for dates for all my cloud functions. Interesting that the serializer.ts file specifically says its built to handle dates but has no functionality for dates at all. Either the documentation should change to reflect the current state or the function should include date handling. Furthermore the cloud functions should also handle serializing and deserializing firebase classes such as Timestamps and GeoPoints as it probably is not uncommon to be sending those documents in and out of cloud functions. |
any chance for this?? |
Hi. We hear you. We are still looking into the best way to support this. Thank you for your feedback and your patience. |
Glad you’re looking into it! I know serialization/deserialization comes with a lot of caveats. And finally you can just leave it up to the user and provide a way to extend the serialize/deserialize functions arbitrarily which would allow the user to easily use any class type they please. I’m sure you’ve already dug into these options but thought I might as well write em out. Thanks! |
This is still an issue, and I've just experienced it. This should be a pretty standard thing to support, what is its progress? |
[REQUIRED] Describe your environment
[REQUIRED] Describe the problem
Javascript dates passed as arguments to firebase functions are converted to empty objects. The code in https://github.com/firebase/firebase-js-sdk/blob/master/packages/functions/src/serializer.ts does not account for dates as distinct from objects. I believe the more idiomatic method would either be to serialize dates as iso8601 and expect that functions convert to a javascript date themselves or to make use of the '@type' properties used in decode (though, obviously, this would require some backend changes). Also, despite the comment to the contrary, the decode method does not appear to handle dates.
Steps to reproduce:
Invoke a function via the callable interface.
The text was updated successfully, but these errors were encountered: