-
Notifications
You must be signed in to change notification settings - Fork 15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
undefined
cannot be serialized as JSON.
#4
Comments
I'm not sure about what causes the error,
basically you can get rid of error on by not passing an export async function getServerSideProps({ query }) {
const apiResult = await getAlgoliaData(query);
return {
props: {
totalNumOfHits: apiResult?.nbHits || null,
// ...rest
},
};
} |
Thank you, I have tried all the methods on the Internet, but it still doesn't work. Hopefully the Docker version can be added. |
aa sorry for that. not sure if i'm gonna improve this project any further though. you could replace the search using another service anyway, but I suggest to just tweaking the algolia on your repo to make it work on your case instead since implementation can be anything but the flow has already been there |
Don't be sorry, that's ok, but thank you anyway for your project and help, hope you can continue, your project is great! I will support you! |
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 fromgetServerSideProps
in "/search".Reason:
undefined
cannot be serialized as JSON. Please usenull
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?
The text was updated successfully, but these errors were encountered: