We have deployed a Next.js application on ECS Fargate but every 3-4 days the application crashes and the same application is working fine on dev instance on EC2 and previously was deployed on Heroku
the issue is with window.__NEXT_DATA__ json is not properly loaded look at the image below:
sorry about the blurry image but this issue randomly happens on some pages and to fix it all we need to do is restart the task and the app again starts working fine for the next 4-5 days
we also have auto-scaling already enabled
we have been closely monitoring the app for any error logs or cpu/memory usage but everything seems fine
what else should we look for any suggestion would be highly appreciated