question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

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:closed
  • Created a year ago
  • Reactions:1
  • Comments:8 (1 by maintainers)

github_iconTop GitHub Comments

2reactions
lahirumarambacommented, Jul 5, 2022

Hi @abedzantout does importing FieldValue, import { FieldValue } from 'firebase-admin/firestore'; fixes this issue for you?

2reactions
redpandatronicsukcommented, Jul 5, 2022

Importing like this seems to work: import { FieldValue } from 'firebase-admin/firestore';

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found