title: Error: Response is not valid JSON object on firebase function with onCall
body: <p>Here is my cloud function code</p>
  <pre><code> exports.markThemAllRead = functions.https.onCall((data) =&gt; {
      const user = {
          id: data.id,
      }
      let batch = admin.firestore().batch();
  
      admin.firestore().collection(&quot;Notifications&quot;).doc(&quot;comments&quot;).collection(user.id).get().then(querySnapshot =&gt; {
          if(querySnapshot.empty){
              return &quot;nice&quot;
          }else {
              querySnapshot.forEach(doc=&gt;{
                  batch.update(doc.ref, {isRead:true})
              });
              return batch.commit()
          }
      }).catch(err =&gt; {
          console.log(err)
      })
      return &quot;Good&quot;
      })
  </code></pre>
  <p>I tried many combinations of return statements, but I keep getting <strong>Error: Response is not valid JSON object</strong>. Can anyone guide me through what could the issue be? I have many other working onCall functions in my code, but this is one is the only one with the batch.update()... perhaps that has something to do with it?</p>
  <p><strong>EDIT ATTEMPT</strong></p>
  <p>Still getting the same error when trying this:</p>
  <pre><code>exports.markThemAllRead = functions.https.onCall((data) =&gt; {
      const user = {
          id: data.id,
      }
  
      return markThemRead(user)
  
  })
  
  async function markThemRead(user){
      let batch = admin.firestore().batch();
  
      const docsRef = admin.firestore().collection(&quot;Notifications&quot;).doc(&quot;comments&quot;).collection(user.id)
  
      const docs = await docsRef.get();
  
      docs.forEach(function(doc){
          batch.update(doc.ref, {isRead:true})
      })
  
      return batch.commit()
  
  }
  </code></pre>