title: Error: Value for argument "documentPath" is not a valid resource path. Path must be a non-empty string. /*what is empty or not a string*/
body: <p>this is the error that I get. I checked multiple times that the paths that I indicate are actually pointing at something in the database. I'm kinda going crazy about why this is not working, so help will be appreciated. (the same error is given by both functions, two times every invocation of the function)
  this is my code:</p>
  <pre><code>exports.onCreatePost = functions.firestore
    .document('/time/{userid}/date/{postId}')
    .onCreate (async (snapshot, context) =&gt; {
        const postCreated = snapshot.data();
        const userID = context.params.userid;
        const postID = context.params.postId;
  
        //get all the followers who made the post
        const userFollowerRef = admin.firestore().collection('time').doc(userID).collection('followers');
        const querySnap = await userFollowerRef.get();
  
        //add the post in each follower timeline 
        querySnap.forEach(doc =&gt; {
            const followerid = doc.id;
            admin.firestore().collection('time').doc(followerid).collection('timelinePosts').doc(postID).set(postCreated);
        })
    });
  
  //when a post is updated
  exports.onUpdatePost = functions.firestore
    .document('/time/{userid}/date/{postid}')
    .onUpdate(async (change, context) =&gt; {
        const postUpdated = change.after.data();
        const userID = context.params.userid;
        const postID = context.params.postId;
        //get all the followers who made the post
        const userFollowerRef = admin.firestore().collection('time').doc(userID).collection('followers');
        const querySnap = await userFollowerRef.get();
  
        //Update the post in each follower timeline
        querySnap.forEach(doc =&gt; {
            const follower = doc.id;
            admin.firestore().collection('time').doc(follower).collection('timelinePosts').doc(postID)
                .get().then(doc =&gt; {
                    if (doc.exists) {
                        doc.ref.update(postUpdated);
                    }
                });
        });
    });
  </code></pre>
  <p>I personally don't know how to log each variable and did not find how to do it online. I'll keep searching but in the mindtime I can share my extensive logs that from my interpretation are not very useful but maybe is just because I'm inexperienced.
  this is the error log
  <a href="https://i.stack.imgur.com/90pra.png" rel="nofollow noreferrer">enter image description here</a></p>