#nextimage doesn't work with cloudfront at all

12 messages · Page 1 of 1 (latest)

kind flower
#
next version: 13.1.1 (didn't work in 13.0.1 as well)
Hey guys I recently tried to optimize the site with next/image but it says invalid props everytime. I thought maybe because of some package, and tried with fresh creat-next-app@latest but still it says the same error. please help.

next.config.js:

/** @type {import('next').NextConfig} */

require('dotenv').config();

const withPWA = require('next-pwa');


const withBundleAnalyzer = require('@next/bundle-analyzer')({
  enabled: process.env.ANALYZE === 'true',
})

const removeImports = require("next-remove-imports")();

/*module.exports = (phase, { nextConfig }) => {
  return removeImports({
    ...nextConfig
  });
};*/

module.exports = (removeImports(withBundleAnalyzer(withPWA({
  images: {
    domains: ['dtosvk5k1dc7u.cloudfront.net'],
    remotePatterns: [
      {
        protocol: 'https',
        hostname: 'dtosvk5k1dc7u.cloudfront.net',
      },
    ],
  },
  reactStrictMode: true,
  swcMinify: true,
  rules: {
    "react/display-name": "off",
  },

  env: {
    ACCESS_KEY: process.env.ACCESS_KEY,
    SECRET_KEY: process.env.SECRET_KEY,
    REGION: process.env.REGION,
  },

  pwa: {
    dest: "public",
    register: true,
    skipWaiting: true,
    disable: process.env.NODE_ENV === "development",
  },
}))));


new:
/** @type {import('next').NextConfig} */
const nextConfig = {
  images: {
    domains: ['dtosvk5k1dc7u.cloudfront.net'],
    remotePatterns: [
      {
        protocol: 'https',
        hostname: 'dtosvk5k1dc7u.cloudfront.net',
      },
    ],
  },
  reactStrictMode: true,
}

module.exports = nextConfig
```js
grizzled vine
#

Can you try exporting only the last nextConfig?

tough crater
kind flower
tough crater
#

Did you try my repo locally? 🤔

#

Just to make sure it works for u

#

I dont think its a cloudfront configuration issue since it's next/image giving u the error

kind flower
tough crater
#

Ok.. so what could be going wrong in your case? I presume your project isnt public on github right?

#

(Actually could you make a new repo with your config and the image and upload it on github?)

kind flower
#

mate I found the problem