1

I've successfully built my first Next.js App and deployed it on Vercel. It runs on an ExpressJs Backend with MongoDB for the Database. It's a site with lyrics for various songs. So here is my problem. While everything is working fine, the moment I add a new Lyric Document (A song and its lyrics) it does not load it, displaying an Error404 page. Same thing if I create a new user. It does not load his/hers profile and displays an Error404 page. In my development environment (Linked to the same API/DB) it works just fine. Can someone please help me?

More specifically. Here is the link to my deployed site: Lyrical Place

Here is the latest and only document I uploaded AFTER Production: SONG

It displays a 404 page, while it shouldn't. In my DB it exists and in my development app it works fine!


Note 1: To add any lyric document I've left a /contribute page ONLY in my development environment.

Note 2: I suspect it has to do with getStaticPaths on my /songs/artists/title dir. But it might not be that case at all.


EDIT: 1

RELEVANT CODE:

getStaticPaths on /songs/artists/title:

export const getStaticPaths = async () => {
const res = await fetch(`${process.env.PROXY}api/lyrics/getAll`);

const data = await res.json();

const paths = data.all.map((name) => ({ params: { singer: name.singer.toString(), title: name.title.toString() } }));

return {
    paths: paths,
    fallback: false
}

}

Kr1ss
  • 90
  • 2
  • 6
  • Does this answer your question: [How to add new pages without rebuilding an app with +150k static pages?](https://stackoverflow.com/a/66037031/1870780)? You're using `fallback: false` which means new pages added after you've built the app are not generated, and will 404. Use `fallback: 'blocking'` instead. – juliomalves Feb 07 '22 at 22:27
  • 1
    Yes, thank you very much! I just had to make every **fallback** to **'blocking'**. – Kr1ss Feb 07 '22 at 22:45

0 Answers0