firebase / firebase/firebase-functions

OnCall functions does not handle Date in return data

Open
#988 7 comments 0 reactions 0 assignees View on GitHub
feature request
Dominant language
TypeScript
Stars
1.1k
Forks
232
Avg merge
20h 46m
Merged PRs (30d)
15

Description

### [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

```js
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:
```json
{
"result": {
"d": "2021-10-12T13:11:44.977Z"
}
}
```

### [REQUIRED] Actual behavior

Response must contain ISO formatted date. Like:
```json
{
"result": {
"d": {}
}
}
```

Contributor guide

Open the contributing guide

Research direction

Start with the functions.https.onCall entry point and reproduce the Date return value using the emulator and the versions listed in the report. Trace how the onCall response is serialized; done means the returned Date appears as an ISO-formatted string instead of an empty object.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, node.js
Domain
api, backend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.