core.js:4197 ERROR FirebaseError: Function CollectionReference.doc() requires its first argument to be of type non-empty string, but it was: undefined code example
Example: Unhandled Rejection (FirebaseError): Function Firestore.collection() cannot be called with an empty path.
Add condition if parameter exists
if (id) {
...
}