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
}
}