title: Firebase Cloud Functions does not create document in a subcollection
body: <p>When I use Firebase Cloud Functions in my Flutter app to create a document inside a collection it works:</p>
  <pre><code>const functions = require('firebase-functions');
  const admin = require('firebase-admin');
  exports.onCreatePost = functions.firestore
      .document(&quot;/posts/{postId}&quot;)
      .onCreate(async (snap, context) =&gt; {
          const doc = snap.data()
          const creatorId = doc.creatorId
          admin.firestore().collection('feeds').doc(creatorId).set({ 
                    Id: creatorId, 
                    isRead: false, 
                    timestamp: admin.firestore.FieldValue.serverTimestamp(), 
              })
          });
  </code></pre>
  <p>But when I try to add the same document inside a subcollection in that document, it does not work:</p>
  <pre><code>const functions = require('firebase-functions');
  const admin = require('firebase-admin'); 
  exports.onCreatePost = functions.firestore
      .document(&quot;/posts/{postId}&quot;)
      .onCreate(async (snap, context) =&gt; {
          const doc = snap.data()
          const creatorId = doc.creatorId
          admin.firestore().collection('feeds').doc(creatorId).collection('feedItems').doc(context.params.postId).set({ 
                    Id: creatorId, 
                    isRead: false, 
                    timestamp: admin.firestore.FieldValue.serverTimestamp(), 
              })
          });
  </code></pre>
  <p>What am I doing wrong? I do see that the cloud function was completed successfully in the logs, but the docment is not created in my Cloud Firestore.<a href="https://i.stack.imgur.com/2xYJF.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/2xYJF.png" alt="enter image description here" /></a></p>