• 카테고리

    질문 & 답변
  • 세부 분야

    풀스택

  • 해결 여부

    미해결

사용 게시글 강의에서 SerializableError

23.04.17 00:45 작성 조회수 311

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 에러가 났을 것이고 그건 백엔드에서 에러가 있을 거고요.

장산님의 프로필

장산

질문자

2023.04.18

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