Skip to content
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

[Firestore] Timestamp.fromDate(date) broken #1793

Closed
fabienpatou opened this issue Jul 4, 2022 · 3 comments
Closed

[Firestore] Timestamp.fromDate(date) broken #1793

fabienpatou opened this issue Jul 4, 2022 · 3 comments

Comments

@fabienpatou
Copy link

  • Operating System version: N/A
  • Firebase (admin) SDK version: 11.0.0
  • Firebase Product: Firestore
  • Node.js version: 16
  • NPM version: 8.9.0

Timestamp.fromDate(date) is broken with following error:

TypeError: Cannot read properties of undefined (reading 'fromDate')
at dateToTimestamp (/Users/fabienpatou/dev/plato-backend-firebase/functions/lib/utils/utils.js:129:61)
at /Users/fabienpatou/dev/plato-backend-firebase/functions/lib/B2BFunctions/Agenda/rejectCall.js:67:52
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async /Users/fabienpatou/dev/plato-backend-firebase/functions/node_modules/firebase-functions/lib/common/providers/https.js:407:26
at async runFunction (/usr/local/lib/node_modules/firebase-tools/lib/emulator/functionsEmulatorRuntime.js:564:9)
at async runHTTPS (/usr/local/lib/node_modules/firebase-tools/lib/emulator/functionsEmulatorRuntime.js:590:5)
at async handler (/usr/local/lib/node_modules/firebase-tools/lib/emulator/functionsEmulatorRuntime.js:510:17)

@google-oss-bot
Copy link

I found a few problems with this issue:

  • I couldn't figure out how to label this issue, so I've labeled it for a human to triage. Hang tight.
  • This issue does not seem to follow the issue template. Make sure you provide all the required information.

@lahirumaramba
Copy link
Member

Hey @fabienpatou you might want to import the Timestamp type from Firestore. Could you try adding import { Timestamp } from 'firebase-admin/firestore';? Thanks.

@fabienpatou
Copy link
Author

Thanks @lahirumaramba, it's working !

The following is not working:
import * as admin from "firebase-admin"; admin.firestore.Timestamp.fromDate(date);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants