Skip to content
Discussion options

You must be logged in to vote

The problem here is that you're not actually returning anything from getServerSideProps(). The only return in the code snippet is inside of forEach(). You want something like this:

export async function getServerSideProps() {
    return firebase.firestore().collection('stuff').get()
    .then(docs => {
      let stuff = [];
      docs.forEach(doc => {
        stuff.push({
          id: doc.id,
          ...doc.data()
        })
      })
      return { props:{ stuff }};
    })
}

or

export async function getServerSideProps() {
    const docs = await firebase.firestore().collection('stuff').get()
    let stuff = [];
    docs.forEach(doc => {
      stuff.push({
        id: doc.id,
        ...doc

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@Vista1nik
Comment options

Answer selected by Vista1nik
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Help
Labels
None yet
2 participants
Converted from issue

This discussion was converted from issue #12601 on May 07, 2020 19:41.