Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
293 views
in Technique[技术] by (71.8m points)

reactjs - Next.js searches images in local directory not on AWS

We are converting our app to Next.js from Create React App.

Next.js should load images from AWS but this not happen. Why?

It worked some days ago. Do you think it's some caching problems or what?

Do you any ideas?

In Next.js the app loads the images from this local URL:

http://localhost:3000/_next/image?url=https%3A%2F%2Fticket-t01.s3.eu-central-1.amazonaws.com%2Fob8h_0.cover.jpg&w=1200&q=100

next.config.js:

const { nextI18NextRewrites } = require("next-i18next/rewrites");

const localeSubpaths = {
  hu: "hu",
  en: "en"
};

module.exports = {
  rewrites: async () => nextI18NextRewrites(localeSubpaths),
  publicRuntimeConfig: {
    localeSubpaths
  },
  images: {
    domains: ["ticket-t01.s3.eu-central-1.amazonaws.com"]
  }
};

1 Image tag:

<Image
  src={`https://ticket-t01.s3.eu-central-1.amazonaws.com/${props.imgId}_0.cover.jpg`}
  className={styles.imageEventMain}
  alt="main event"
  layout="responsive"
  width={1795}
  height={1000}
  quality={100}
/>;

In React there wasn't problems with AWS or image loading.

EDIT

console.log when trying to access the images:

enter image description here

question from:https://stackoverflow.com/questions/66056135/next-js-searches-images-in-local-directory-not-on-aws

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...