serverTimestamp is undefined after upgrading from v10 to v11
See original GitHub issue[READ] Step 1: Are you in the right place?
- For issues related to the code in this repository file a Github issue.
- If the issue pertains to Cloud Firestore, read the instructions in the “Firestore issue” template.
- For general technical questions, post a question on StackOverflow with the firebase tag.
- For general Firebase discussion, use the firebase-talk google group.
- For help troubleshooting your application that does not fall under one of the above categories, reach out to the personalized Firebase support channel.
[REQUIRED] Step 2: Describe your environment
- Operating System version: MacOS 12.4
- Firebase SDK version: 11
- Firebase Product: admin and functions (auth, database, storage, etc)
- Node.js version: ^16
- NPM version: ^8
[REQUIRED] Step 3: Describe the problem
Upgrading from v10 to v11 breaks admin.firestore.FieldValue.serverTimestamp(); functionality.
Steps to reproduce:
Run any set, add, update on collection, and include a timestamp on cloud function.
Downgrading back to v10 works.
What happened? How can we make the problem occur? This could be a description, log/console output, etc.
TypeError: Cannot read properties of undefined (reading 'serverTimestamp')
Relevant Code:
`collection('any').add({createdAt: admin.firestore.FieldValue.serverTimestamp()})`
I apologize if this was mentioned somewhere else or if there are migration steps in the changelog.
Issue Analytics
- State:
- Created a year ago
- Reactions:1
- Comments:8 (1 by maintainers)
Top Results From Across the Web
[Firestore] admin.firestore.Timestamp.now() fails with ...
Timestamp.now() throws TypeError: Cannot read properties of undefined (reading 'now') (~same with admin.firestore.increment(1) ).
Read more >Firestore serverTimestamp() undefined - node.js
I recently updated the admin SDK and the firebase-tools to the versions above, then the problem started occurring.
Read more >The secrets of Firestore's FieldValue.serverTimestamp()
Everything you need to know about Firestore server timestamps, including writes, queries, security rules, and time travel safety tips.
Read more >IBM Security Guardium V10.6
Windows: Managing S-TAP when upgrading your database operating system ... Guardium v10.5 supports Oracle V.11 and Oracle V.12 databases on an AWS cloud....
Read more >Kabo
serverTimestamp is undefined after upgrading from v10 to v11 · Issue #1799 · firebase/firebase-ad... [READ] Step 1: Are you in the right ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Hi @abedzantout does importing
FieldValue
,import { FieldValue } from 'firebase-admin/firestore';
fixes this issue for you?Importing like this seems to work:
import { FieldValue } from 'firebase-admin/firestore';