Skip to content

undefined cannot be serialized as JSON. #4

@s3689

Description

@s3689

my website:
http://207.246.109.130:3000
ubuntu 22.04
next@10.2.3
algoliasearch@4.13.1

http://207.246.109.130:3000/search?q=test
(Algolia is configured, and the data can also be seen in the background)

http://207.246.109.130:3000/user?idaaa=test

Server Error:
Error: Error serializing .totalNumOfHits returned from getServerSideProps in "/search".
Reason: undefined cannot be serialized as JSON. Please use null or omit this value.

Call Stack
isSerializable
file:///root/HeckarNews/website/node_modules/next/dist/lib/is-serializable-props.js (7:95)

file:///root/HeckarNews/website/node_modules/next/dist/lib/is-serializable-props.js (7:490)
Array.every

isSerializable
file:///root/HeckarNews/website/node_modules/next/dist/lib/is-serializable-props.js (7:291)
isSerializableProps
file:///root/HeckarNews/website/node_modules/next/dist/lib/is-serializable-props.js (9:219)
renderToHTML
file:///root/HeckarNews/website/node_modules/next/dist/next-server/server/render.js (42:1318)
processTicksAndRejections
node:internal/process/task_queues (96:5)
async
file:///root/HeckarNews/website/node_modules/next/dist/next-server/server/next-server.js (112:97)
async
file:///root/HeckarNews/website/node_modules/next/dist/next-server/server/next-server.js (105:142)
async DevServer.renderToHTMLWithComponents
file:///root/HeckarNews/website/node_modules/next/dist/next-server/server/next-server.js (137:387)
async DevServer.renderToHTML
file:///root/HeckarNews/website/node_modules/next/dist/next-server/server/next-server.js (138:610)
async DevServer.renderToHTML
file:///root/HeckarNews/website/node_modules/next/dist/server/next-dev-server.js (36:578)
async DevServer.render
file:///root/HeckarNews/website/node_modules/next/dist/next-server/server/next-server.js (75:160)
async Object.fn
file:///root/HeckarNews/website/node_modules/next/dist/next-server/server/next-server.js (58:672)
async Router.execute
file:///root/HeckarNews/website/node_modules/next/dist/next-server/server/router.js (25:67)
async DevServer.run
file:///root/HeckarNews/website/node_modules/next/dist/next-server/server/next-server.js (68:1042)

your website will be fine:
https://forum.krehwell.com/search?q=test
https://forum.krehwell.com/user?idaaa=yakuza

How to solve it?
Also, how can I prevent error messages from appearing on the browser side?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions