작성
·
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)
이 에러가 떴는데 user-[id].js에서 getServerSideProps 코드가 잘못되었다는 뜻인가요?
아니면 undefined나 null을 어떻게 처리할것인지..
잘모르겠습니다
답변 1
1
백엔드에 에러 메시지 있을 겁니다. 저런 에러는 왜 저 에러가 났을지를 생각해보시면 됩니다. loadPosts 에러가 났을 것이고 그건 백엔드에서 에러가 있을 거고요.
하하 image를 models폴더에서 import를 안해서 저런오류가 나왔습니다.