Next.js Discord

Discord Forum

Too many Static Pages to render in getStaticPaths() causing vercel build fail Error...

Answered
Labh posted this in #help-forum
Open in Discord
I'm trying to render static pages for my dynamic routes
I'm using firestore to get my data for page

export async function getStaticPaths() { const q = query(collection(db, "musicians"), limit(300)); const querySnapshot = await getDocs(q); const paths = querySnapshot.docs.map((doc) => ({ params: { id: doc.id }, })); return { paths, fallback: "blocking", }; } // Fetch data for a single doc export async function getStaticProps(context) { const id = context.params?.id; const docRef = doc(db, "musicians", id); const docSnap = await getDoc(docRef); if (!docSnap.exists()) { return { notFound: true, }; }

I know the data json I'm fetching for each page is large which I can reduce further, so if I static render like 300 pages it works and all pages are rendered..
So I've 464 docs in firestore collection if I increase the limit more than 300 vercel deploy fails

But it didn't tell me what error was

What the cause for this? Is the vercel limits the build or there are total size limit?
Answered by joulev
Still, try not logging for a particular deployment
View full answer

10 Replies

UP
All logs are json data for each page,
I forgot to get the specific field that I need to show on page directly fetched all json data
it's about 3000 line json data per file...
Also logs is not the problem I guess cause the 300 one that build successfully also have 10k lines
Answer
And see if it works
@Labh How to do that?
By just removing the console.log calls? Why do those logs show up?
@joulev By just removing the console.log calls? Why do those logs show up?
OoO I forgot that...
I can see the error now, one doc after 300th had invalid data was causing error, that was not showing due to these 10k logs😂 ...
Thanks