question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Issue with Static generation and ISR

See original GitHub issue

What version of Next.js are you using?

11.0.0

What version of Node.js are you using?

14.16.1

What browser are you using?

Microsoft Edge

What operating system are you using?

Windows

How are you deploying your application?

next start

Describe the Bug

I am observing inconsistent behavior with static generation and ISR (getStaticPaths & getStaticProps). My requirement is pull a list of reports available from the database for a certain Type and Category. For the example code given below, the code runs perfectly on my local machine (Node Version 14.16.1 on Windows). However on AWS server (Node Version 14.18.0 Ubuntu Linux), the build script only picks up 3-4 static paths and then while running, it says failed to getStaticProps - which possibly should be some exception that I am not getting on my local machine somehow. I also tried to run the database access code separately on my AWS server however it resulted the correct output.

Expected Behavior

The code should reflect same behavior whether Ubuntu or Windows. Also the fallback: true from getStaticPaths doesn’t seems to be working. On Ubuntu, setting fallback: true results in getStaticProps error and fallback:false results in 404 error. I tried getStaticPaths both ways - pulling those from Db (as commented code) and hardcoding. But no difference.

To Reproduce

export async function getStaticPaths() { /* const reportMaster = await daos.getReportMaster(); const categories = await reportMaster.getAllCategories(); const paths = await categories.map((data) => ({ params: { category: encodeURI(${data.category}), reportType: ${data.reportType}` }, })); return { paths, fallback: true } */ return { paths: [{ params: { category: ‘Fixed Income And Currency Market’, reportType: ‘Research’ }, params: { category: ‘Credit Market’, reportType: ‘Research’ }, params: { category: ‘Credit Research’, reportType: ‘Research’ }, params: { category: ‘RBI Policy’, reportType: ‘Research’ }, params: { category: ‘Equity Market’, reportType: ‘Research’ }, params: { category: ‘Union Budget’, reportType: ‘Research’ }, params: { category: ‘Blogs’, reportType: ‘Knowledge’ }, params: { category: ‘Support’, reportType: ‘Knowledge’ }, params: { category: ‘Liquidity Cheat Sheet’, reportType: ‘MarketData’ }, params: { category: ‘Primary Corporate Bond Market’, reportType: ‘MarketData’ }, params: { category: ‘Corporate Bond and Money Market Traded Data’, reportType: ‘MarketData’ }, params: { category: ‘RBI Operations’, reportType: ‘MarketData’ }, params: { category: ‘Deposit and Credit Data’, reportType: ‘MarketData’ }, params: { category: ‘Forex Data’, reportType: ‘MarketData’ }, params: { category: ‘FII investment’, reportType: ‘MarketData’ }, }], fallback: true }; }

export async function getStaticProps(context) { const reportMaster = await daos.getReportMaster() let articles = await reportMaster.getArticleDataByCategory(context.params.category); if(!articles) return {notFound: true, };

return {props: {articles: JSON.stringify(articles), reportType: context.params.reportType, category: context.params.category}, revalidate: 3600};

} `

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:8 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
vitthalzephyrcommented, Oct 2, 2021

~I’ll try to reproduce it locally. (I work from Linux). I cannot test with AWS, but I can try the hardcoded values.~

I, unfortunately, could not reproduce this with the code you provided. 😕 Do you have a repository maybe?

Problem is even I cannot reproduce it on my local machine. It gives no problem with hardcoded values. Issue is only if I pull from database. Let me come back if I can create a small repo to reproduce.

0reactions
balazsorban44commented, Jan 27, 2022

This issue has been automatically locked due to no recent activity. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you.

Read more comments on GitHub >

github_iconTop Results From Across the Web

A Complete Guide To Incremental Static Regeneration (ISR ...
Below you'll find a guide to ISR — including use cases, demos and tradeoffs. The Problem with Static-Site Generation #. The idea behind...
Read more >
Incremental Static Regeneration - Data Fetching - Next.js
Incremental Static Regeneration (ISR) enables you to use static-generation on a per-page basis, without needing to rebuild the entire site.
Read more >
Incremental Static Regeneration – Vercel Docs
Incremental Static Regeneration (ISR) allows you to create or update content without redeploying your site. ISR has three main benefits for developers: ...
Read more >
Understand Next.js's incremental static regeneration against ...
In this blog post, we took a look at the difference between Server Side Rendering (SSR), Static Site Generation (SSG), and Incremental Static...
Read more >
Incremental Static Regeneration: Its Benefits and Its Flaws
Incremental Static Regeneration, or ISR, seeks to extend the power of static sites by adding some server-side rendering (SSR) goodies on top ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found