I already create an issue in nextjs- https://github.com/vercel/next.js/issues/41287.
My problem is I use next js standalone mode for deploying my site into aws ec2. I successfully do this. My site is running in this url- https://www.nekmart.com/
Here I am facing some image optimization issue. My site is fully SSR. I create a dashboard site for uploading new assets(Like product, category, brand etc). I can see that only the new image are not coming with optimization (webP format). But previous image comes with optimization. Here If I build my project again then I can see all images are optimized. Then again if I upload new Image, then that image are not optimizing properly. I can't understand what is the problem. If anybody can help me.
Here I have some questions-
- We know that vercel automatically install the essential package for image optimization and setup their server automatically. But in the other server (such as aws ec2, azure virtual machine) do not provide the essential environment for my next js project. My question is If there is any manual to setup and ready for next js to any other server like aws ec2, azure virtual machine, Then please provide proper information and docs.
- Hence I am not getting image not optimization issue in the local, then if there have any special things to do my project to working all image optimization after deploying the site.
Here is my server spec-
- Aws EC2 OS- ubuntu Type- t2 micro Memory- 1GB Storage- 30GB
- Azure Virtual Machine- OS- ubuntu Type- 22_04-lts-gen2 Memory- 3.5 GB Storage- 20GB
Here please note I am facing this issue when I deploy my standalone mode to aws ec2. But When I run it in local, I ma not facing any image optimization issue.
Here is more info-
next.config.js
-
/** @type {import('next').NextConfig} */
const withPWA = require("next-pwa")({
dest: "public",
register: true,
disable: process.env.NODE_ENV === "development"
});
const nextConfig = {
reactStrictMode: true,
swcMinify: true,
output: "standalone",
images: {
minimumCacheTTL: 2592000,
domains: ["dzzoo94ozikw5.cloudfront.net", "lh3.googleusercontent.com", "platform-lookaside.fbsbx.com"]
},
}
I am assure that my project have sharp package installed. Also I am not getting any sharp missing related error in my terminal.
My next js version 12.3.0 I also try it in version 12.3.1
**In local I use windows 11 with 12 GB Ram and Core i5, 7 gen processor as I say that in local image optimization works perfectly.
Please help me to debugging the problem. I am not getting any reply from nextjs.