Hi i need help in getServerSideProps :
export async function getServerSideProps({ locale, query }) {
console.log(process.env.URL_API_GATEWAY); // this logs well https://...
try {
const response = await fetch(`${process.env.URL_API_GATEWAY}/article/v1/articles/${query.id}`); this returns undefined
if (!response.ok) {
throw new Error("Failed to fetch.");
}
const item = await response.json();
return {
props: {
item,
...(await serverSideTranslations(locale, ["common", "supply", "api"])),
},
};
} catch (error) {
console.error("Error fetching data:", error);
return {
props: {
item: null,
...(await serverSideTranslations(locale, ["common", "supply", "api"])),
},
};
}
}
So env variable logs but i can't use it in fetch method,
what kind of problem this seems to be ?