강의

멘토링

로드맵

Inflearn brand logo image

인프런 커뮤니티 질문&답변

장산님의 프로필 이미지
장산

작성한 질문수

[리뉴얼] React로 NodeBird SNS 만들기

사용자 게시글, 해시태그 게시글

사용 게시글 강의에서 SerializableError

작성

·

413

0

SerializableError: Error serializing `.initialState.post.loadPostsError` returned from `getServerSideProps` in "/user/[id]".
Reason: `undefined` cannot be serialized as JSON. Please use `null` or omit this value all together.
    at isSerializable (/Users/js/Desktop/sansbook/node_modules/next/dist/lib/is-serializable-props.js:7:95)
    at /Users/js/Desktop/sansbook/node_modules/next/dist/lib/is-serializable-props.js:7:503
    at Array.every (<anonymous>)
    at isSerializable (/Users/js/Desktop/sansbook/node_modules/next/dist/lib/is-serializable-props.js:7:304)
    at /Users/js/Desktop/sansbook/node_modules/next/dist/lib/is-serializable-props.js:7:503
    at Array.every (<anonymous>)
    at isSerializable (/Users/js/Desktop/sansbook/node_modules/next/dist/lib/is-serializable-props.js:7:304)
    at /Users/js/Desktop/sansbook/node_modules/next/dist/lib/is-serializable-props.js:7:503
    at Array.every (<anonymous>)
    at isSerializable (/Users/js/Desktop/sansbook/node_modules/next/dist/lib/is-serializable-props.js:7:304)

스크린샷 2023-04-17 오전 12.41.40.png이 에러가 떴는데 user-[id].js에서 getServerSideProps 코드가 잘못되었다는 뜻인가요?

아니면 undefined나 null을 어떻게 처리할것인지..

잘모르겠습니다

답변 1

1

제로초(조현영)님의 프로필 이미지
제로초(조현영)
지식공유자

백엔드에 에러 메시지 있을 겁니다. 저런 에러는 왜 저 에러가 났을지를 생각해보시면 됩니다. loadPosts 에러가 났을 것이고 그건 백엔드에서 에러가 있을 거고요.

장산님의 프로필 이미지
장산
질문자

하하 image를 models폴더에서 import를 안해서 저런오류가 나왔습니다.

장산님의 프로필 이미지
장산

작성한 질문수

질문하기