title: scheduled cloud function error: Function returned undefined, expected promise or value
body: <p>I'm trying to create a scheduled cloud function which updates a document field with a value from an api call. However I get the error mentioned above in the logs, altought I'm returning a promise (as far as I know)</p>
  
  <p>Any help is appretiated</p>
  
  <p>the api call returns this json: </p>
  
  <pre><code>{ "alarm": "false" }
  </code></pre>
  
  <p>My Code:</p>
  
  <pre><code>import * as functions from 'firebase-functions';
  import * as admin from 'firebase-admin';
  import * as rp from 'request-promise';
  
  admin.initializeApp()
  
  export const scheduledAlarmUpdate = functions.pubsub.schedule('every 30 minutes').onRun((context) =&gt; {
  
      const docRef = admin.firestore().collection('alarms').doc('stuttgart');
      const username = 'bitfactory';
      const pass = '...';
  
      const options = {
          url: 'https://api.bitfactory.io/fineparticlesalarm/',
          auth: {
              user: username,
              password: pass
          },
          method: 'GET',
          json: true
      }
  
      return rp(options).then(data =&gt; {
          console.log(data.alarm)
  
          docRef.set({
              alarm: data.alarm
          })
          .catch(err =&gt; {
              console.log(err);
          });
      })
  });
  </code></pre>