Used fetch function in server Component it’s work perfect in development but when deploy to vercel or netlify it does not fetch the data .
I even try to revalidate:0 and cache: no-store so it does not fetch at build time , I also check my env base url it’s perfect , in postmen same url giving response as expected
async function getItems() {
const header = headers();
try {
const res = await fetch(
`${process.env.NEXT_PUBLIC_DOMAIN!}api/Fees/Status`,
{
method: "GET",
headers: header,
}
);
const data = await res.json();
console.log(data);
return data;
} catch (error) {
console.log(error);
}
}
export default async function Page() {
let data = await getItems();
var dayscount =
countDaysFromGivenDateToCurrent(data?.FeesRecord.feesPaidupto) || 0;
Return feesrecord in development but when I tried in production I do not received any data
New contributor
saad anwar is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.