firebase-functions icon indicating copy to clipboard operation
firebase-functions copied to clipboard

OnCall functions does not handle Date in return data

Open niklv opened this issue 3 years ago • 2 comments

[REQUIRED] Version info

node: 14.17.2

firebase-functions: 3.15.7

firebase-tools: 9.20.0

firebase-admin: 9.12.0

[REQUIRED] Test case

const functions = require("firebase-functions")

module.exports.testFunc = functions.https.onCall((data, req) => ({
  d: new Date()
}))

[REQUIRED] Steps to reproduce

  1. Run emulator
  2. Make functions request

[REQUIRED] Expected behavior

Response must contain ISO formatted date. Like:

{
  "result": {
    "d": "2021-10-12T13:11:44.977Z"
  }
}

[REQUIRED] Actual behavior

Response must contain ISO formatted date. Like:

{
  "result": {
    "d": {}
  }
}

niklv avatar Oct 12 '21 13:10 niklv

Dates are not part of the encoding specification for the onCall API. This is still a reasonable feature request. I'll label it as such.

inlined avatar Oct 21 '21 18:10 inlined