79772205

Date: 2025-09-23 04:19:25
Score: 0.5
Natty:
Report link

it says the api call inside cannot be taken place like in nextjs build. so just put return above the api call like . (before docker update the env for prodcution)

async function getCaseStudies(): Promise<CaseStudy[]> {

    if(process.env.NODE_ENV === "Production"){
    
return [];    
    }

  const res = await fetch(`${process.env.NEXT_PUBLIC_API_BASE_URL}/api/v1/case-studies/`, {
    next: { revalidate: 600 }, // Revalidate every 600 seconds (10 minutes)
  });

  if (!res.ok) {
    // This will activate the closest `error.js` Error Boundary
    throw new Error('Failed to fetch case studies');
  }

  return res.json();
}
Reasons:
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Unregistered user (0.5):
  • Low reputation (1):
Posted by: user31548750