I am trying to set up a firebase cloud function that regularly makes an api call to the Feedly API.
However, it is not working and I'm not sure why. Here is the code:
const functions = require('firebase-functions')
const express = require('express')
const fetch = require('node-fetch')
const admin = require('firebase-admin')
admin.initializeApp()
const db = admin.firestore()
const app = express()
exports.getNewsArticles = functions.pubsub
  .schedule('every 5 minutes')
  .onRun(() => {
    app.get('/feedly', async (request, response) => {
      const apiUrl = `https://cloud.feedly.com/v3/streams/contents?streamId=user/[USER_ID_NUMBER]/category/global.all&count=100&ranked=newest&newThan=300000`
      const fetchResponse = await fetch(apiUrl, {
        headers: {
          Authorization: `Bearer ${functions.config().feedly.access}`
        }
      })
      const json = await fetchResponse.json()
      json.items.forEach(item => {
        db.collection('news').add({
          status: 'pending',
          author: item.author || '',
          content: item.content || '',
          published: item.published || '',
          summary: item.summary || '',
          title: item.title || '',
        })
      })
    })
  })
Any idea what I need to do to get this to work?