Firebase Functions emulator: admin.firestore.Timestamp.now() throws 'TypeError: Cannot read properties of undefined (reading 'now')' (same for FieldValue.serverTimestamp) but works in plain Node
Fix: import the Firestore helpers from the modular entry point instead of the admin namespace: const { FieldValue, Timestamp, getFirestore } = require("firebase-admin/firestore") (TS: import { FieldValue, Timestamp, getFirestore } from "firebase-admin/firestore"). Then FieldValue.serverTimestamp(), FieldValue.increment(1) and Timestamp.now() work inside the emulator.
Cause: when the Functions emulator loads your code it replaces the firebase-admin module with a Proxy (functionsEmulatorRuntime.js). For function-valued properties like admin.firestore the proxy returns value.bind(target), and a bound function does not carry the static properties of the original, so admin.firestore is still callable (admin.firestore() gives you a working db) while admin.firestore.Timestamp and admin.firestore.FieldValue are undefined. Outside the emulator the same code runs fine, which makes it look like a firebase-admin bug.
Reproduced with firebase-tools 15.36.0, firebase-admin 12.7.0, firebase-functions 5.1.1, CommonJS: inside an onRequest handler typeof admin.firestore was "function" and typeof admin.firestore.Timestamp was "undefined", while the modular Timestamp/FieldValue imports worked and a document with FieldValue.serverTimestamp() was written. The same firebase-admin 12.7.0 in plain Node (tsc CommonJS, with or without esModuleInterop) has both statics defined.
Also grep for leftovers such as admin.firestore.FieldValue.increment(1) in Firestore triggers: they hit the same error only when that trigger fires.