You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I hope so. This might be a problem with the Emulator, not sure...
[REQUIRED] Step 2: Describe your environment
Operating System version: macOS Monterey 12.6 (also happened on Ubuntu machines)
Firebase SDK version: 11.12.1
Firebase Product: functions
Node.js version: 16.18.1
NPM version: 8.19.2
[REQUIRED] Step 3: Describe the problem
Starting with version 11 of the admin SDK creation of an admin.firestore.FieldPath object does throw an error (in Emulator only).
The call still works when deployed to Firebase.
Error happening:
⚠ functions: TypeError: admin.firestore.FieldPath is not a constructor
Steps to reproduce:
Just call new admin.firestore.FieldPath("test") in a firebase function in emulator environment.
⚠ functions: TypeError: admin.firestore.FieldPath is not a constructor
at /###/functions/lib/index.js:11:18
at cloudFunction (/###/functions/node_modules/firebase-functions/lib/cloud-functions.js:78:23)
at /usr/local/lib/node_modules/firebase-tools/lib/emulator/functionsEmulatorRuntime.js:516:16
at runFunction (/usr/local/lib/node_modules/firebase-tools/lib/emulator/functionsEmulatorRuntime.js:504:15)
at runBackground (/usr/local/lib/node_modules/firebase-tools/lib/emulator/functionsEmulatorRuntime.js:515:11)
at processBackground (/usr/local/lib/node_modules/firebase-tools/lib/emulator/functionsEmulatorRuntime.js:499:11)
at /usr/local/lib/node_modules/firebase-tools/lib/emulator/functionsEmulatorRuntime.js:690:27
at Layer.handle [as handle_request] (/usr/local/lib/node_modules/firebase-tools/node_modules/express/lib/router/layer.js:95:5)
at next (/usr/local/lib/node_modules/firebase-tools/node_modules/express/lib/router/route.js:137:13)
at next (/usr/local/lib/node_modules/firebase-tools/node_modules/express/lib/router/route.js:131:14)
Relevant Code:
import * as functions from "firebase-functions";
import * as admin from "firebase-admin";
admin.initializeApp();
export const
.firestore
.document("/test/{testId}")
.onWrite(async (change) => {
const path = new admin.firestore.FieldPath("test");
const item = await admin.firestore().collection("test")
.where(path, "==", "test")
.get();
console.log(item.docs.length);
});
Error only happens in emulator, not on deployed functions.
Downgrading to firebase-admin 10 solves the problem.
The text was updated successfully, but these errors were encountered:
[READ] Step 1: Are you in the right place?
I hope so. This might be a problem with the Emulator, not sure...
[REQUIRED] Step 2: Describe your environment
[REQUIRED] Step 3: Describe the problem
Starting with version 11 of the admin SDK creation of an
admin.firestore.FieldPath
object does throw an error (in Emulator only).The call still works when deployed to Firebase.
Error happening:
Steps to reproduce:
Just call
new admin.firestore.FieldPath("test")
in a firebase function in emulator environment.A detailed reproduction with a minimal example is displayed here:
https://github.com/nerdlibfront/firebase-admin-fieldpath-problem
This leads to:
Relevant Code:
Error only happens in emulator, not on deployed functions.
Downgrading to firebase-admin 10 solves the problem.
The text was updated successfully, but these errors were encountered: