0

So, im trying to get the videoPaths of my database, and get that error, that's the code, and i get that on another post here in stackoverflow

export const getStaticProps = async () => {
let videos = [];
 try {
   const querySnapshot = await firebase
  .firestore()
  .collection('allVideos')
  .get();

querySnapshot.forEach(function (doc) {
  console.log(doc.data().title);
  console.log(doc.data().pid);
  videos.push({
    pid: doc.data().pid,
    title: doc.data().title,
  });
});
} catch (error) {
 console.log('Error getting documents: ', error);
}

return {
  props: {
    videos,
  },
};
};
  • Does this answer your question: [Get downloadURL keeps throwing error 'XMLHttpRequest is not defined' using Firebase](https://stackoverflow.com/questions/55671126/get-downloadurl-keeps-throwing-error-xmlhttprequest-is-not-defined-using-fireb)? Try using [`firebase-admin`](https://www.npmjs.com/package/firebase-admin) on the server-side (`getStaticProps`). – juliomalves Jun 07 '21 at 20:09

0 Answers0