FirebaseError: [code=invalid-argument]: Function setDoc() called with invalid data. Data must be an object, but it was: a custom Object object
This is a variable typing problem when trying to pass a Firebase reference as a parameter.
The problem is described in another post: Node-red is somehow mutating normal Object so I can't pass it into Firestore setDoc() function
The problem has been discussed but using another library is not the solution.
As Sulomus indicates, when creating an object in nodered it does not have the type "object" but "Object object", which is not accepted by the Firebase SDK.