[REQUIRED] Step 2: Describe your environment
- Operating System version: MacOS
- Firebase SDK version: 8.3.0
- Library version: _____
- Firebase Product: Firestore database
- Node Version: 10.15.1
[REQUIRED] Step 3: Describe the problem
Steps to reproduce:
This issue (by someone else) describes both the problem and the resolution: https://stackoverflow.com/questions/55065567/cloud-firestore-node-js-invalid-use-of-type-object-as-a-firestore-argument
For prosperity, I am facing the same problem using Node-Red to send a JSON object like this:
payload: {text: "hello world",createdAt: newDate(),user: {_id: 1000}// This causes the issue}Which is then called in the function:
this.firestore.collection(col).add(payload)
And throws the error:
Invaliduseoftype"object"asaFirestoreargument
The workaround, as the SO thread explains is to edit
node_modules/@google-cloud/firestore/build/src/serializer.js
and change isPlainObject to
function isPlainObject(input) {
return util_1.isObject(input);
}
Is there a more permanent solution that I can use? This is fine on my development environment, but I will need to deploy this to an environment where I cannot edit node_modules
Many thanks
[REQUIRED] Step 2: Describe your environment
[REQUIRED] Step 3: Describe the problem
Steps to reproduce:
This issue (by someone else) describes both the problem and the resolution: https://stackoverflow.com/questions/55065567/cloud-firestore-node-js-invalid-use-of-type-object-as-a-firestore-argument
For prosperity, I am facing the same problem using Node-Red to send a JSON object like this:
Which is then called in the function:
And throws the error:
The workaround, as the SO thread explains is to edit
node_modules/@google-cloud/firestore/build/src/serializer.jsand change
isPlainObjecttoIs there a more permanent solution that I can use? This is fine on my development environment, but I will need to deploy this to an environment where I cannot edit node_modules
Many thanks