Error serializing on homepage and 404 on slug pages in cms-prismic example
See original GitHub issueBug report
Describe the bug
Viewing of vanilla prismic example works fine on homepage but returns a 404 whenever navigating to slug pages. preview mode also returns this
To Reproduce
Steps to reproduce the behavior, please provide code snippets or a repository:
- Clone cms-prismic example
- Add env variables
- yarn install && yarn dev / now dev
- Navigate to any post
Expected behavior
Preview not working Live example allows viewing of blog post. (Currently password protected)
Screenshots
System information
- OS: macOS
- Browser: Chrome and Edge (Chromium)
- Version of Next.js: 9.2.3-canary.26 but also tried 9.4
- Version of Node.js: v10.16.3
- prismic-javascript: 2.7.1
Additional context
When trying to integrate with latest packages from npm and Typescript there is an additional error related to the preview.
Error: Error serializing `.preview` returned from `getStaticProps` in "/".
Reason: `undefined` cannot be serialized as JSON. Please use `null` or omit this value all together.
Setting preview = null in getStaticProps
removes this but the slug pages still return 404’s.
Issue Analytics
- State:
- Created 3 years ago
- Reactions:1
- Comments:7 (7 by maintainers)
Top Results From Across the Web
Empty page instead of 404 error when url contains channel slug
I have a website where my client can create entries in a couple of different channels. Lets take a "news" channel. The url...
Read more >Error: How to serialize data from getStaticProps : Next.js
The error: Server Error Error: Error serializing .profileData returned from getStaticProps in "/profile/[slug]". Reason: undefined cannot be ...
Read more >How to Avoid 404 Errors When Updating Your WordPress Site
404 errors in WordPress mean that the URL to a web page you're trying to visit is broken, or the page doesn't exist...
Read more >How to fix error serializing Date object JSON in Next.js
This has the effect of converting the Date object to a string. I like this solution because it's obvious, visible, and not intrusive....
Read more >The ultimate guide to WordPress 404 pages - Highrise Digital
You can view your website's 404 error page by simply entering a no ... a page from one URL to another, for example...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@chibicode I have since switched to the Sanity example and it’s working perfectly (what a great platform). However I did check and the slugs were being returned.
@ismamz was correct, it was defaulting to
en-us
but my Prismic settings geolocated me toen-gb
. The strange thing is the posts on the homepage were fine, but only when usingyarn dev
not withnow dev
. Submitted PR so this doesn’t happen to anyone else. #12862As the examples evolve might want to put some fail safes in place as this was breaking in production too.
Thanks for the help guys. Still gonna stick with Sanity.
This issue has been automatically locked due to no recent activity. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you.