🧩외부 이미지 주소가 허용되지 않음 (next/image)
Invalid src prop (https://images.example.com/a.jpg) on `next/image`, hostname "images.example.com" is not configured under images in your `next.config.js`
Next.js의 이미지 부품은 허락한 주소의 이미지만 보여 줘요. 그 주소가 설정에 없다는 뜻이에요.
🤔 왜 생기나요?
- 다른 사이트(또는 스토리지)의 이미지 주소를 next/image에 넣었어요
- 설정 파일(next.config)에 그 주소를 등록하지 않았어요
🔧 이렇게 해 보세요
- next.config의 images 설정에 그 도메인을 추가해요
- 설정을 바꾼 뒤 개발 서버를 껐다 켜요
🤖 AI에게 이렇게 물어보세요
next/image에서 아래 에러가 나. 이 이미지 주소를 next.config의 images 설정에 안전하게(필요한 주소만) 추가해 줘. [여기에 에러 전체를 붙여 넣기]
[ ] 부분은 내 상황에 맞게 바꾸고, 에러는 앞뒤 몇 줄까지 넉넉히 복사해 붙여 넣으세요.
관련 용어
같은 분류의 다른 에러
- 비어 있는 값을 읽으려 함 (undefined)
Cannot read properties of undefined - 함수가 아닌 것을 실행하려 함
is not a function - 정의되지 않은 이름
ReferenceError: … is not defined - JSON이 아닌 응답 (Unexpected token)
Unexpected token '<' … is not valid JSON - 서버 화면과 브라우저 화면이 다름 (Hydration)
Hydration failed - 무한 반복 그리기 (Too many re-renders)
Too many re-renders - 목록에 key가 없음
Each child in a list should have a unique "key" prop - use client가 필요함 (Next.js)
Add the "use client" directive - 함수가 끝없이 자기 자신을 부름 (호출 스택 초과)
RangeError: Maximum call stack size exceeded - 그리는 도중에 다른 컴포넌트를 바꾸려 함
Cannot update a component while rendering a different component - 객체를 화면에 그대로 출력하려 함
Objects are not valid as a React child - 서버에서 브라우저 기능을 씀 (window is not defined)
ReferenceError: window is not defined - 클라이언트 컴포넌트를 async로 만듦
async/await is not yet supported in Client Components - Suspense로 감싸야 함 (useSearchParams)
useSearchParams() should be wrapped in a suspense boundary - 처리하지 않은 비동기 에러
Uncaught (in promise) - 날짜를 읽지 못함 (Invalid Date)
Invalid Date - 숫자 자리에 NaN이 나옴
NaN