Q: Next getStaticProps() and mongoose issue when running npm run build Maybe this is a simpler issue than it seems, and I can't use components on statically generated pages with Next.
But for some reason my app keeps failing to pre-render these pages. It works great on the dev server. So that lead me to assume it has to with the data being pulled from the DB. But when I check the data straight from the source, the array is fine, no extra items or wrapper elements from Mongoose.
I am using Next.js with MongoDB/Mongoose.  See below for sample code.
import Layout from "../../Components/Layout/Layout";
import dbConnect from "../../utils/db-connect";
import Blog from "../../Models/blogpost";
import styles from "./singlePage.module.css";
import PostBody from "../../Components/Blog/PostBody/PostBody";
import HeaderDisplay from "../../Components/Blog/Header/HeaderDisplay/HeaderDisplay";

const Display = (props) => {
  const { posts } = props;

  return (
    <Layout>
      <div className={styles.singlePost}>
        <HeaderDisplay data={posts[0]} />
        <PostBody data={posts[0]} />
      </div>
    </Layout>
  );
};

export async function getStaticProps(context) {
  const { params } = context;
  const id = params.pid;
  await dbConnect();
  const posts = await Blog.find({});
  //stupid fix but it seems to be the one
  //const finalPosts = JSON.parse(JSON.stringify(posts));

  const finalPosts = posts.map((item) => {
    let finalPost = item.toObject();
    finalPost._id = finalPost._id.toString();
    finalPost.author.date = finalPost.author.date.toString();
    return finalPost;
  });
  const dataFinal = finalPosts.filter((item, index) => {
    return item._id === id;
  });
  console.log(finalPosts);
  console.log(dataFinal);

  if (dataFinal.length === 0) {
    return {
      notFound: true,
    };
  }

  return {
    props: {
      posts: dataFinal,
    },
    notFound: false,
  };
}

export async function getStaticPaths() {
  await dbConnect();
  const posts = await Blog.find({});
  //odd fix but it seems to be the one
  //const finalPosts = JSON.parse(JSON.stringify(posts));

  const finalPosts = posts.map((item) => {
    let finalPost = item.toObject();
    finalPost._id = finalPost._id.toString();
    finalPost.author.date = finalPost.author.date.toString();
    return finalPost;
  });
  const dynamicPaths = finalPosts.map((item, index) => {
    return { params: { pid: item._id } };
  });
  console.log(dynamicPaths);
  return {
    paths: dynamicPaths,
    fallback: true,
  };
}

And below is what is returned when i console.log the data i'm passing into the page. Which is accutate.
//!Array we get from DB
/*
[
  {
    author: {
      date: 'Tue Mar 30 2021 18:09:45 GMT-0700 (Pacific Daylight Time)',
      name: 'Jon',
      read: 5
    },
    tags: [ 'React', 'Mongo', 'Next' ],
    body: [ [Object], [Object], [Object] ],
    _id: '6063cbde8172000667834400',
    title: 'Tester 1',
    quip: 'Tester 1',
    mainImg: 'https://res.cloudinary.com/dxtqihvgt/image/upload/v1617145104/Blog%20Images/clickity_uj6qud.jpg',
    __v: 0
  },
  {
    author: {
      date: 'Tue Mar 30 2021 18:11:14 GMT-0700 (Pacific Daylight Time)',
      name: 'Mikey',
      read: 5
    },
    tags: [ 'JS' ],
    body: [ [Object], [Object], [Object] ],
    _id: '6063cc358172000667834401',
    title: 'TESTER 2',
    quip: 'Tester 2',
    mainImg: 'https://res.cloudinary.com/dxtqihvgt/image/upload/v1617148584/Blog%20Images/sort_ticpka.jpg',
    __v: 0
  },
  {
    author: {
      date: 'Tue Mar 30 2021 18:11:52 GMT-0700 (Pacific Daylight Time)',
      name: 'Jon',
      read: 5
    },
    tags: [ 'Next', 'Mongo' ],
    body: [ [Object], [Object], [Object] ],
    _id: '6063cc648172000667834402',
    title: 'TESTER 3',
    quip: 'tester 3',
    mainImg: 'https://res.cloudinary.com/dxtqihvgt/image/upload/v1617148584/Blog%20Images/sort_ticpka.jpg',
    __v: 0
  },
  {
    author: {
      date: 'Tue Mar 30 2021 20:14:40 GMT-0700 (Pacific Daylight Time)',
      name: 'Mikey',
      read: 5
    },
    tags: [ 'Mongo', 'Express', 'JS', 'Node' ],
    body: [ [Object], [Object], [Object] ],
    _id: '6063e9265d575e08a28d002d',
    title: 'TESTER 4',
    quip: 'Teester 4',
    mainImg: 'https://res.cloudinary.com/dxtqihvgt/image/upload/v1617148584/Blog%20Images/sort_ticpka.jpg',
    __v: 0
  },
  {
    author: {
      date: 'Tue Mar 30 2021 20:18:33 GMT-0700 (Pacific Daylight Time)',
      name: 'Mikey',
      read: 5
    },
    tags: [ 'Mongo', 'JS' ],
    body: [ [Object], [Object], [Object] ],
    _id: '6063ea0c5d575e08a28d002e',
    title: 'TESTER 5',
    quip: 'tester 5',
    mainImg: 'https://res.cloudinary.com/dxtqihvgt/image/upload/v1617145104/Blog%20Images/clickity_uj6qud.jpg',
    __v: 0
  }
]
*/
//!After matching to an ID
/*
[
  {
    author: {
      date: 'Tue Mar 30 2021 20:18:33 GMT-0700 (Pacific Daylight Time)',
      name: 'Mikey',
      read: 5
    },
    tags: [ 'Mongo', 'JS' ],
    body: [ [Object], [Object], [Object] ],
    _id: '6063ea0c5d575e08a28d002e',
    title: 'TESTER 5',
    quip: 'tester 5',
    mainImg: 'https://res.cloudinary.com/dxtqihvgt/image/upload/v1617145104/Blog%20Images/clickity_uj6qud.jpg',
    __v: 0
  }
]
*/
//!pid pathways
/*
[
  { params: { pid: '6063cbde8172000667834400' } },
  { params: { pid: '6063cc358172000667834401' } },
  { params: { pid: '6063cc648172000667834402' } },
  { params: { pid: '6063e9265d575e08a28d002d' } },
  { params: { pid: '6063ea0c5d575e08a28d002e' } }
]

But then when I build it, I get this error first - which i'm assuming has to do with the data being queried in the DB. But again, when i look at what data is being queried, the _id's and the pid's match up.
[ ===] info  - Generating static pages (6/14)
Error occurred prerendering page "/[pid]". Read more: https://err.sh/next.js/prerender-error
TypeError: Cannot read property '0' of undefined

Entire build log
next build

info  - Creating an optimized production build  
info  - Compiled successfully
info  - Collecting page data .open and connected
info  - Collecting page data ..[
  { params: { pid: '6063cbde8172000667834400' } },
  { params: { pid: '6063cc358172000667834401' } },
  { params: { pid: '6063cc648172000667834402' } },
  { params: { pid: '6063e9265d575e08a28d002d' } },
  { params: { pid: '6063ea0c5d575e08a28d002e' } }
]
info  - Collecting page data  
[  ==] info  - Generating static pages (0/14)open and connected
open and connected
open and connected
[   =] info  - Generating static pages (0/14)open and connected
[
  {
    author: { date: 2021-03-31T01:09:45.948Z, name: 'Jon', read: 5 },
    tags: [ 'React', 'Mongo', 'Next' ],
    body: [ [Object], [Object], [Object] ],
    _id: 6063cbde8172000667834400,
    title: 'Tester 1',
    quip: 'Tester 1',
    mainImg: 'https://res.cloudinary.com/dxtqihvgt/image/upload/v1617145104/Blog%20Images/clickity_uj6qud.jpg',
    __v: 0
  },
  {
    author: { date: 2021-03-31T01:11:14.886Z, name: 'Mikey', read: 5 },
    tags: [ 'JS' ],
    body: [ [Object], [Object], [Object] ],
    _id: 6063cc358172000667834401,
    title: 'TESTER 2',
    quip: 'Tester 2',
    mainImg: 'https://res.cloudinary.com/dxtqihvgt/image/upload/v1617148584/Blog%20Images/sort_ticpka.jpg',
    __v: 0
  },
  {
    author: { date: 2021-03-31T01:11:52.375Z, name: 'Jon', read: 5 },
    tags: [ 'Next', 'Mongo' ],
    body: [ [Object], [Object], [Object] ],
    _id: 6063cc648172000667834402,
    title: 'TESTER 3',
    quip: 'tester 3',
    mainImg: 'https://res.cloudinary.com/dxtqihvgt/image/upload/v1617148584/Blog%20Images/sort_ticpka.jpg',
    __v: 0
  },
  {
    author: { date: 2021-03-31T03:14:40.677Z, name: 'Mikey', read: 5 },
    tags: [ 'Mongo', 'Express', 'JS', 'Node' ],
    body: [ [Object], [Object], [Object] ],
    _id: 6063e9265d575e08a28d002d,
    title: 'TESTER 4',
    quip: 'Teester 4',
    mainImg: 'https://res.cloudinary.com/dxtqihvgt/image/upload/v1617148584/Blog%20Images/sort_ticpka.jpg',
    __v: 0
  },
  {
    author: { date: 2021-03-31T03:18:33.641Z, name: 'Mikey', read: 5 },
    tags: [ 'Mongo', 'JS' ],
    body: [ [Object], [Object], [Object] ],
    _id: 6063ea0c5d575e08a28d002e,
    title: 'TESTER 5',
    quip: 'tester 5',
    mainImg: 'https://res.cloudinary.com/dxtqihvgt/image/upload/v1617145104/Blog%20Images/clickity_uj6qud.jpg',
    __v: 0
  }
]
[    ] info  - Generating static pages (3/14)1
[  ==] info  - Generating static pages (6/14)
Error occurred prerendering page "/[pid]". Read more: https://err.sh/next.js/prerender-error
TypeError: Cannot read property '0' of undefined
    at Display (/Users/jonathankirkpatrick/Desktop/Hired/evronBlog/evronblog/.next/server/pages/[pid].js:589:20)
    at d (/Users/jonathankirkpatrick/Desktop/Hired/evronBlog/evronblog/node_modules/react-dom/cjs/react-dom-server.node.production.min.js:33:498)
    at bb (/Users/jonathankirkpatrick/Desktop/Hired/evronBlog/evronblog/node_modules/react-dom/cjs/react-dom-server.node.production.min.js:36:16)
    at a.b.render (/Users/jonathankirkpatrick/Desktop/Hired/evronBlog/evronblog/node_modules/react-dom/cjs/react-dom-server.node.production.min.js:42:43)
    at a.b.read (/Users/jonathankirkpatrick/Desktop/Hired/evronBlog/evronblog/node_modules/react-dom/cjs/react-dom-server.node.production.min.js:41:83)
    at exports.renderToString (/Users/jonathankirkpatrick/Desktop/Hired/evronBlog/evronblog/node_modules/react-dom/cjs/react-dom-server.node.production.min.js:52:138)
    at Object.renderPage (/Users/jonathankirkpatrick/Desktop/Hired/evronBlog/evronblog/node_modules/next/dist/next-server/server/render.js:54:851)
    at Function.getInitialProps (/Users/jonathankirkpatrick/Desktop/Hired/evronBlog/evronblog/.next/server/pages/_document.js:719:19)
    at loadGetInitialProps (/Users/jonathankirkpatrick/Desktop/Hired/evronBlog/evronblog/node_modules/next/dist/next-server/lib/utils.js:5:101)
    at renderToHTML (/Users/jonathankirkpatrick/Desktop/Hired/evronBlog/evronblog/node_modules/next/dist/next-server/server/render.js:54:1142)
    at async /Users/jonathankirkpatrick/Desktop/Hired/evronBlog/evronblog/node_modules/next/dist/export/worker.js:26:6
    at async Span.traceAsyncFn (/Users/jonathankirkpatrick/Desktop/Hired/evronBlog/evronblog/node_modules/next/dist/telemetry/trace/trace.js:5:584)
open and connected
[ ===] info  - Generating static pages (6/14)open and connected
[
  {
    author: {
      date: 'Tue Mar 30 2021 18:09:45 GMT-0700 (Pacific Daylight Time)',
      name: 'Jon',
      read: 5
    },
    tags: [ 'React', 'Mongo', 'Next' ],
    body: [ [Object], [Object], [Object] ],
    _id: '6063cbde8172000667834400',
    title: 'Tester 1',
    quip: 'Tester 1',
    mainImg: 'https://res.cloudinary.com/dxtqihvgt/image/upload/v1617145104/Blog%20Images/clickity_uj6qud.jpg',
    __v: 0
  },
  {
    author: {
      date: 'Tue Mar 30 2021 18:11:14 GMT-0700 (Pacific Daylight Time)',
      name: 'Mikey',
      read: 5
    },
    tags: [ 'JS' ],
    body: [ [Object], [Object], [Object] ],
    _id: '6063cc358172000667834401',
    title: 'TESTER 2',
    quip: 'Tester 2',
    mainImg: 'https://res.cloudinary.com/dxtqihvgt/image/upload/v1617148584/Blog%20Images/sort_ticpka.jpg',
    __v: 0
  },
  {
    author: {
      date: 'Tue Mar 30 2021 18:11:52 GMT-0700 (Pacific Daylight Time)',
      name: 'Jon',
      read: 5
    },
    tags: [ 'Next', 'Mongo' ],
    body: [ [Object], [Object], [Object] ],
    _id: '6063cc648172000667834402',
    title: 'TESTER 3',
    quip: 'tester 3',
    mainImg: 'https://res.cloudinary.com/dxtqihvgt/image/upload/v1617148584/Blog%20Images/sort_ticpka.jpg',
    __v: 0
  },
  {
    author: {
      date: 'Tue Mar 30 2021 20:14:40 GMT-0700 (Pacific Daylight Time)',
      name: 'Mikey',
      read: 5
    },
    tags: [ 'Mongo', 'Express', 'JS', 'Node' ],
    body: [ [Object], [Object], [Object] ],
    _id: '6063e9265d575e08a28d002d',
    title: 'TESTER 4',
    quip: 'Teester 4',
    mainImg: 'https://res.cloudinary.com/dxtqihvgt/image/upload/v1617148584/Blog%20Images/sort_ticpka.jpg',
    __v: 0
  },
  {
    author: {
      date: 'Tue Mar 30 2021 20:18:33 GMT-0700 (Pacific Daylight Time)',
      name: 'Mikey',
      read: 5
    },
    tags: [ 'Mongo', 'JS' ],
    body: [ [Object], [Object], [Object] ],
    _id: '6063ea0c5d575e08a28d002e',
    title: 'TESTER 5',
    quip: 'tester 5',
    mainImg: 'https://res.cloudinary.com/dxtqihvgt/image/upload/v1617145104/Blog%20Images/clickity_uj6qud.jpg',
    __v: 0
  }
]
[
  {
    author: {
      date: 'Tue Mar 30 2021 18:11:52 GMT-0700 (Pacific Daylight Time)',
      name: 'Jon',
      read: 5
    },
    tags: [ 'Next', 'Mongo' ],
    body: [ [Object], [Object], [Object] ],
    _id: '6063cc648172000667834402',
    title: 'TESTER 3',
    quip: 'tester 3',
    mainImg: 'https://res.cloudinary.com/dxtqihvgt/image/upload/v1617148584/Blog%20Images/sort_ticpka.jpg',
    __v: 0
  }
]
[
  {
    author: {
      date: 'Tue Mar 30 2021 18:09:45 GMT-0700 (Pacific Daylight Time)',
      name: 'Jon',
      read: 5
    },
    tags: [ 'React', 'Mongo', 'Next' ],
    body: [ [Object], [Object], [Object] ],
    _id: '6063cbde8172000667834400',
    title: 'Tester 1',
    quip: 'Tester 1',
    mainImg: 'https://res.cloudinary.com/dxtqihvgt/image/upload/v1617145104/Blog%20Images/clickity_uj6qud.jpg',
    __v: 0
  },
  {
    author: {
      date: 'Tue Mar 30 2021 18:11:14 GMT-0700 (Pacific Daylight Time)',
      name: 'Mikey',
      read: 5
    },
    tags: [ 'JS' ],
    body: [ [Object], [Object], [Object] ],
    _id: '6063cc358172000667834401',
    title: 'TESTER 2',
    quip: 'Tester 2',
    mainImg: 'https://res.cloudinary.com/dxtqihvgt/image/upload/v1617148584/Blog%20Images/sort_ticpka.jpg',
    __v: 0
  },
  {
    author: {
      date: 'Tue Mar 30 2021 18:11:52 GMT-0700 (Pacific Daylight Time)',
      name: 'Jon',
      read: 5
    },
    tags: [ 'Next', 'Mongo' ],
    body: [ [Object], [Object], [Object] ],
    _id: '6063cc648172000667834402',
    title: 'TESTER 3',
    quip: 'tester 3',
    mainImg: 'https://res.cloudinary.com/dxtqihvgt/image/upload/v1617148584/Blog%20Images/sort_ticpka.jpg',
    __v: 0
  },
  {
    author: {
      date: 'Tue Mar 30 2021 20:14:40 GMT-0700 (Pacific Daylight Time)',
      name: 'Mikey',
      read: 5
    },
    tags: [ 'Mongo', 'Express', 'JS', 'Node' ],
    body: [ [Object], [Object], [Object] ],
    _id: '6063e9265d575e08a28d002d',
    title: 'TESTER 4',
    quip: 'Teester 4',
    mainImg: 'https://res.cloudinary.com/dxtqihvgt/image/upload/v1617148584/Blog%20Images/sort_ticpka.jpg',
    __v: 0
  },
  {
    author: {
      date: 'Tue Mar 30 2021 20:18:33 GMT-0700 (Pacific Daylight Time)',
      name: 'Mikey',
      read: 5
    },
    tags: [ 'Mongo', 'JS' ],
    body: [ [Object], [Object], [Object] ],
    _id: '6063ea0c5d575e08a28d002e',
    title: 'TESTER 5',
    quip: 'tester 5',
    mainImg: 'https://res.cloudinary.com/dxtqihvgt/image/upload/v1617145104/Blog%20Images/clickity_uj6qud.jpg',
    __v: 0
  }
]
[
  {
    author: {
      date: 'Tue Mar 30 2021 18:11:14 GMT-0700 (Pacific Daylight Time)',
      name: 'Mikey',
      read: 5
    },
    tags: [ 'JS' ],
    body: [ [Object], [Object], [Object] ],
    _id: '6063cc358172000667834401',
    title: 'TESTER 2',
    quip: 'Tester 2',
    mainImg: 'https://res.cloudinary.com/dxtqihvgt/image/upload/v1617148584/Blog%20Images/sort_ticpka.jpg',
    __v: 0
  }
]
[====] info  - Generating static pages (10/14)[
  {
    author: {
      date: 'Tue Mar 30 2021 18:09:45 GMT-0700 (Pacific Daylight Time)',
      name: 'Jon',
      read: 5
    },
    tags: [ 'React', 'Mongo', 'Next' ],
    body: [ [Object], [Object], [Object] ],
    _id: '6063cbde8172000667834400',
    title: 'Tester 1',
    quip: 'Tester 1',
    mainImg: 'https://res.cloudinary.com/dxtqihvgt/image/upload/v1617145104/Blog%20Images/clickity_uj6qud.jpg',
    __v: 0
  },
  {
    author: {
      date: 'Tue Mar 30 2021 18:11:14 GMT-0700 (Pacific Daylight Time)',
      name: 'Mikey',
      read: 5
    },
    tags: [ 'JS' ],
    body: [ [Object], [Object], [Object] ],
    _id: '6063cc358172000667834401',
    title: 'TESTER 2',
    quip: 'Tester 2',
    mainImg: 'https://res.cloudinary.com/dxtqihvgt/image/upload/v1617148584/Blog%20Images/sort_ticpka.jpg',
    __v: 0
  },
  {
    author: {
      date: 'Tue Mar 30 2021 18:11:52 GMT-0700 (Pacific Daylight Time)',
      name: 'Jon',
      read: 5
    },
    tags: [ 'Next', 'Mongo' ],
    body: [ [Object], [Object], [Object] ],
    _id: '6063cc648172000667834402',
    title: 'TESTER 3',
    quip: 'tester 3',
    mainImg: 'https://res.cloudinary.com/dxtqihvgt/image/upload/v1617148584/Blog%20Images/sort_ticpka.jpg',
    __v: 0
  },
  {
    author: {
      date: 'Tue Mar 30 2021 20:14:40 GMT-0700 (Pacific Daylight Time)',
      name: 'Mikey',
      read: 5
    },
    tags: [ 'Mongo', 'Express', 'JS', 'Node' ],
    body: [ [Object], [Object], [Object] ],
    _id: '6063e9265d575e08a28d002d',
    title: 'TESTER 4',
    quip: 'Teester 4',
    mainImg: 'https://res.cloudinary.com/dxtqihvgt/image/upload/v1617148584/Blog%20Images/sort_ticpka.jpg',
    __v: 0
  },
  {
    author: {
      date: 'Tue Mar 30 2021 20:18:33 GMT-0700 (Pacific Daylight Time)',
      name: 'Mikey',
      read: 5
    },
    tags: [ 'Mongo', 'JS' ],
    body: [ [Object], [Object], [Object] ],
    _id: '6063ea0c5d575e08a28d002e',
    title: 'TESTER 5',
    quip: 'tester 5',
    mainImg: 'https://res.cloudinary.com/dxtqihvgt/image/upload/v1617145104/Blog%20Images/clickity_uj6qud.jpg',
    __v: 0
  }
]
[
  {
    author: {
      date: 'Tue Mar 30 2021 18:09:45 GMT-0700 (Pacific Daylight Time)',
      name: 'Jon',
      read: 5
    },
    tags: [ 'React', 'Mongo', 'Next' ],
    body: [ [Object], [Object], [Object] ],
    _id: '6063cbde8172000667834400',
    title: 'Tester 1',
    quip: 'Tester 1',
    mainImg: 'https://res.cloudinary.com/dxtqihvgt/image/upload/v1617145104/Blog%20Images/clickity_uj6qud.jpg',
    __v: 0
  }
]
[
  {
    author: {
      date: 'Tue Mar 30 2021 18:09:45 GMT-0700 (Pacific Daylight Time)',
      name: 'Jon',
      read: 5
    },
    tags: [ 'React', 'Mongo', 'Next' ],
    body: [ [Object], [Object], [Object] ],
    _id: '6063cbde8172000667834400',
    title: 'Tester 1',
    quip: 'Tester 1',
    mainImg: 'https://res.cloudinary.com/dxtqihvgt/image/upload/v1617145104/Blog%20Images/clickity_uj6qud.jpg',
    __v: 0
  },
  {
    author: {
      date: 'Tue Mar 30 2021 18:11:14 GMT-0700 (Pacific Daylight Time)',
      name: 'Mikey',
      read: 5
    },
    tags: [ 'JS' ],
    body: [ [Object], [Object], [Object] ],
    _id: '6063cc358172000667834401',
    title: 'TESTER 2',
    quip: 'Tester 2',
    mainImg: 'https://res.cloudinary.com/dxtqihvgt/image/upload/v1617148584/Blog%20Images/sort_ticpka.jpg',
    __v: 0
  },
  {
    author: {
      date: 'Tue Mar 30 2021 18:11:52 GMT-0700 (Pacific Daylight Time)',
      name: 'Jon',
      read: 5
    },
    tags: [ 'Next', 'Mongo' ],
    body: [ [Object], [Object], [Object] ],
    _id: '6063cc648172000667834402',
    title: 'TESTER 3',
    quip: 'tester 3',
    mainImg: 'https://res.cloudinary.com/dxtqihvgt/image/upload/v1617148584/Blog%20Images/sort_ticpka.jpg',
    __v: 0
  },
  {
    author: {
      date: 'Tue Mar 30 2021 20:14:40 GMT-0700 (Pacific Daylight Time)',
      name: 'Mikey',
      read: 5
    },
    tags: [ 'Mongo', 'Express', 'JS', 'Node' ],
    body: [ [Object], [Object], [Object] ],
    _id: '6063e9265d575e08a28d002d',
    title: 'TESTER 4',
    quip: 'Teester 4',
    mainImg: 'https://res.cloudinary.com/dxtqihvgt/image/upload/v1617148584/Blog%20Images/sort_ticpka.jpg',
    __v: 0
  },
  {
    author: {
      date: 'Tue Mar 30 2021 20:18:33 GMT-0700 (Pacific Daylight Time)',
      name: 'Mikey',
      read: 5
    },
    tags: [ 'Mongo', 'JS' ],
    body: [ [Object], [Object], [Object] ],
    _id: '6063ea0c5d575e08a28d002e',
    title: 'TESTER 5',
    quip: 'tester 5',
    mainImg: 'https://res.cloudinary.com/dxtqihvgt/image/upload/v1617145104/Blog%20Images/clickity_uj6qud.jpg',
    __v: 0
  }
]
[
  {
    author: {
      date: 'Tue Mar 30 2021 20:14:40 GMT-0700 (Pacific Daylight Time)',
      name: 'Mikey',
      read: 5
    },
    tags: [ 'Mongo', 'Express', 'JS', 'Node' ],
    body: [ [Object], [Object], [Object] ],
    _id: '6063e9265d575e08a28d002d',
    title: 'TESTER 4',
    quip: 'Teester 4',
    mainImg: 'https://res.cloudinary.com/dxtqihvgt/image/upload/v1617148584/Blog%20Images/sort_ticpka.jpg',
    __v: 0
  }
]
[
  {
    author: {
      date: 'Tue Mar 30 2021 18:09:45 GMT-0700 (Pacific Daylight Time)',
      name: 'Jon',
      read: 5
    },
    tags: [ 'React', 'Mongo', 'Next' ],
    body: [ [Object], [Object], [Object] ],
    _id: '6063cbde8172000667834400',
    title: 'Tester 1',
    quip: 'Tester 1',
    mainImg: 'https://res.cloudinary.com/dxtqihvgt/image/upload/v1617145104/Blog%20Images/clickity_uj6qud.jpg',
    __v: 0
  },
  {
    author: {
      date: 'Tue Mar 30 2021 18:11:14 GMT-0700 (Pacific Daylight Time)',
      name: 'Mikey',
      read: 5
    },
    tags: [ 'JS' ],
    body: [ [Object], [Object], [Object] ],
    _id: '6063cc358172000667834401',
    title: 'TESTER 2',
    quip: 'Tester 2',
    mainImg: 'https://res.cloudinary.com/dxtqihvgt/image/upload/v1617148584/Blog%20Images/sort_ticpka.jpg',
    __v: 0
  },
  {
    author: {
      date: 'Tue Mar 30 2021 18:11:52 GMT-0700 (Pacific Daylight Time)',
      name: 'Jon',
      read: 5
    },
    tags: [ 'Next', 'Mongo' ],
    body: [ [Object], [Object], [Object] ],
    _id: '6063cc648172000667834402',
    title: 'TESTER 3',
    quip: 'tester 3',
    mainImg: 'https://res.cloudinary.com/dxtqihvgt/image/upload/v1617148584/Blog%20Images/sort_ticpka.jpg',
    __v: 0
  },
  {
    author: {
      date: 'Tue Mar 30 2021 20:14:40 GMT-0700 (Pacific Daylight Time)',
      name: 'Mikey',
      read: 5
    },
    tags: [ 'Mongo', 'Express', 'JS', 'Node' ],
    body: [ [Object], [Object], [Object] ],
    _id: '6063e9265d575e08a28d002d',
    title: 'TESTER 4',
    quip: 'Teester 4',
    mainImg: 'https://res.cloudinary.com/dxtqihvgt/image/upload/v1617148584/Blog%20Images/sort_ticpka.jpg',
    __v: 0
  },
  {
    author: {
      date: 'Tue Mar 30 2021 20:18:33 GMT-0700 (Pacific Daylight Time)',
      name: 'Mikey',
      read: 5
    },
    tags: [ 'Mongo', 'JS' ],
    body: [ [Object], [Object], [Object] ],
    _id: '6063ea0c5d575e08a28d002e',
    title: 'TESTER 5',
    quip: 'tester 5',
    mainImg: 'https://res.cloudinary.com/dxtqihvgt/image/upload/v1617145104/Blog%20Images/clickity_uj6qud.jpg',
    __v: 0
  }
]
[
  {
    author: {
      date: 'Tue Mar 30 2021 20:18:33 GMT-0700 (Pacific Daylight Time)',
      name: 'Mikey',
      read: 5
    },
    tags: [ 'Mongo', 'JS' ],
    body: [ [Object], [Object], [Object] ],
    _id: '6063ea0c5d575e08a28d002e',
    title: 'TESTER 5',
    quip: 'tester 5',
    mainImg: 'https://res.cloudinary.com/dxtqihvgt/image/upload/v1617145104/Blog%20Images/clickity_uj6qud.jpg',
    __v: 0
  }
]
info  - Generating static pages (14/14)

> Build error occurred
Error: Export encountered errors on following paths:
    /[pid]
    at /Users/jonathankirkpatrick/Desktop/Hired/evronBlog/evronblog/node_modules/next/dist/export/index.js:31:1103
    at async Span.traceAsyncFn (/Users/jonathankirkpatrick/Desktop/Hired/evronBlog/evronblog/node_modules/next/dist/telemetry/trace/trace.js:5:584)
    at async /Users/jonathankirkpatrick/Desktop/Hired/evronBlog/evronblog/node_modules/next/dist/build/index.js:41:49
    at async Span.traceAsyncFn (/Users/jonathankirkpatrick/Desktop/Hired/evronBlog/evronblog/node_modules/next/dist/telemetry/trace/trace.js:5:584)
    at async /Users/jonathankirkpatrick/Desktop/Hired/evronBlog/evronblog/node_modules/next/dist/build/index.js:23:1472
    at async Span.traceAsyncFn (/Users/jonathankirkpatrick/Desktop/Hired/evronBlog/evronblog/node_modules/next/dist/telemetry/trace/trace.js:5:584)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! evronblog@0.1.0 build: `next build`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the evronblog@0.1.0 build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/jonathankirkpatrick/.npm/_logs/2021-04-01T03_34_45_531Z-debug.log


What could be causing this? It's basically telling me there is an object being pulled that has no properties I beleive?
And jsut for good measure, the function I call to connect to the DB as per the examples provided by Vercel and the Next team. Next mongoose examples
import mongoose from "mongoose";

async function dbConnect() {
  // check if we have a connection to the database or if it's currently
  // connecting or disconnecting (readyState 1, 2 and 3)
  if (mongoose.connection.readyState >= 1) {
    return;
  }

  return mongoose
    .connect("mongodb://localhost:27017/blog-almost", {
      useNewUrlParser: true,
      useUnifiedTopology: true,
      useFindAndModify: false,
      useCreateIndex: true,
      //maxIdleTimeMS: 1000,
      //serverSelectionTimeoutMS: 1000,
      //socketTimeoutMS: 2000,
    })
    .then(console.log("open and connected"));
}

export default dbConnect;


A: So it seems this did the trick, i set fallback to false
export async function getStaticPaths() {
  await dbConnect();
  const posts = await Blog.find({});
  //odd fix but it seems to be the one
  //const finalPosts = JSON.parse(JSON.stringify(posts));

  const finalPosts = posts.map((item) => {
    let finalPost = item.toObject();
    finalPost._id = finalPost._id.toString();
    finalPost.author.date = finalPost.author.date.toString();
    return finalPost;
  });
  const dynamicPaths = finalPosts.map((item, index) => {
    return { params: { pid: item._id } };
  });
  console.log(dynamicPaths);
  return {
    paths: dynamicPaths,
    //fallback: true
    fallback: false,
  };
}

I also spread out the data being passed into my components on the Display page. Not sure if that was necessary but it's definitely easier to follow.
const Display = (props) => {
  const posts = { ...props.post };
  const author = { ...posts.author };
  const tags = [...posts.tags];
  const title = posts.title;
  const quip = posts.quip;
  const mainImg = posts.mainImg;
  const body = posts.body;

  let display = (
    <Layout>
      <div className={styles.singlePost}>
        <HeaderDisplay
          author={author}
          title={title}
          tags={tags}
          mainImg={mainImg}
        />
        <PostBody body={body} quip={quip} />
      </div>
    </Layout>
  );

  return <Fragment>{display}</Fragment>;
};

And the info I really wanted to know but never looked
---fallback: "blocking"
Next.js fallback: "blocking"
