Scale up as you grow — whether you're running one virtual machine or ten thousand.

From GPU-powered inference and Kubernetes to managed databases and storage, get everything you need to build, scale, and deploy intelligent applications.

I am encountering an issue in my nextjs application, The project i am working on is an e-commerce application where backend framework used is laravel and the frontend framework is nextjs.The application is currently hosted on Digital Ocean App Platform and has two separate environments, i.e production and staging.When i add a new product in admin panel, the new product is created and hence it is shown in homepage, but the problem is when i navigate to products detail page,and also when i hover on the product on homepage which uses nextjs Link component and has prefetch enabled it gives me 500 internal server error.
Nextjs and react version used:
{
"next": "13.0.6",
"react": "18.2.0",
"react-dom": "18.2.0",
}
Production:
Staging:
Local Machine
Below is the code for both homepage and product detail page :
Get static props for home page:
export async function getStaticProps() {
const queryClient = new QueryClient();
await queryClient.prefetchQuery({
queryKey: [KEYS.bannerList],
queryFn: getBannerList,
});
await queryClient.prefetchQuery({
queryKey: [KEYS.featuredCategory],
queryFn: fetchFeaturedCategory,
});
await queryClient.prefetchQuery({
queryKey: [KEYS.getAllHomeData],
queryFn: fetchAllHomeData,
});
return {
props: {
dehydratedState: dehydrate(queryClient),
},
revalidate: 10
};
}
Get static paths and getstatic props for product detail page:
export async function getStaticPaths() {
const data = await fetch(`${baseURL}/api/all-product`, {
cache: 'no-cache',
})
.then((response) => response.json())
.then((data) => data?.data);
const paths = await data?.map((product) => ({
params: { product_slug: product.slug },
}));
return {
paths: paths || [],
fallback: 'blocking',
};
}
export async function getStaticProps(context) {
const { product_slug } = context.params;
const queryClient = new QueryClient();
await queryClient.prefetchQuery({
queryKey: [KEYS.productsDetails, { product_slug }],
queryFn: () => getProductDetails(product_slug),
})
return {
props: {
dehydratedState: dehydrate(queryClient),
},
revalidate: 10
};
}
These are the general info’s that i get back from network tabs: GENERAL
RESPONSE HEADERS
What did you try and what were you expecting?
I tried to replicate the issue in local environment in which i had no luck , so my best option is to go to digital ocean’s dashboard and force rebuild and redeploy which only works until the new product is added.
I also tried by updating the version to nextjs to latest stable version.
I tried using nextjs standalone output mode in local environment using docker, which is also working fine.
I am trying to figure out whether the error is from app platform side or nextjs framework side , since the problem is only arising on production environment.
KFSys
KFSys
Manuel Maldonado
07ffbf0c7e1b47f4b26636bc7104f4
Solomon
Jopce
JipSterk
Mireya Leon
alunlewis
Bartek Pacia
3dce080671fd4aad9a5ba722b2da33