-
Notifications
You must be signed in to change notification settings - Fork 985
Closed
Labels
Description
[REQUIRED] Describe your environment
- Operating System version: Windows 10
- Firebase SDK version: 4.12.1
- Firebase Product: functions
[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.
const func = functions.httpsCallable('someFunc');
func({
date: new Date() // this will appear as { date: {} } in someFunc
}).then(({ returnedDate }) => {
// notice that returnedDate is a string
});
uturnr, milesingrams, mohshraim, Zeliret, raduungurean and 4 more