Next.js Discord

Discord Forum

IMAGE_INVALID_OPTIMIZE_REQUEST

Answered
Blue horntail woodwasp posted this in #help-forum
Open in Discord
Avatar
Blue horntail woodwaspOP
Hi everyone, I have a problem while deploy my NextJS app on vercel.
Error :
400: BAD_REQUEST
Code: INVALID_IMAGE_OPTIMIZE_REQUEST
ID: sin1::wtrhd-1698676298164-17de989109b8


I have configure my next.config.js by adding some remote patterns like bellow :
const nextConfig = {
  images: {
    remotePatterns: [
      {
        protocol: "http",
        hostname: "127.0.0.1",
        port: "8000",
        pathname: "/storage/**",
      },
      {
        protocol: "https",
        hostname: "be-kelas-fe.my.id",
        port: "",
        pathname: "/storage/**",
      },
    ],
  },
};

It works fine on local, but somehow its not working after deploy.
Anyone have an idea how to solve this?

Any answer really appriciate
Answered by Blue horntail woodwasp
solve by simplified remotePatterns config :
const nextConfig = {
  images: {
    remotePatterns: [
      {
        protocol: "https",
        hostname: "mydomain.com",
        // port: "",
        // pathname: "/storage/**",
      },
    ],
  },
};
View full answer

1 Reply

Avatar
Blue horntail woodwaspOP
solve by simplified remotePatterns config :
const nextConfig = {
  images: {
    remotePatterns: [
      {
        protocol: "https",
        hostname: "mydomain.com",
        // port: "",
        // pathname: "/storage/**",
      },
    ],
  },
};
Answer