question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Error serializing on homepage and 404 on slug pages in cms-prismic example

See original GitHub issue

Bug 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:

  1. Clone cms-prismic example
  2. Add env variables
  3. yarn install && yarn dev / now dev
  4. Navigate to any post

Expected behavior

Preview not working Live example allows viewing of blog post. (Currently password protected)

Screenshots

Screen Shot 2020-05-12 at 22 45 56 PM Screen Shot 2020-05-12 at 22 40 10 PM

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:closed
  • Created 3 years ago
  • Reactions:1
  • Comments:7 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
b-botcommented, May 14, 2020

@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 to en-gb. The strange thing is the posts on the homepage were fine, but only when using yarn dev not with now dev. Submitted PR so this doesn’t happen to anyone else. #12862

As 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.

0reactions
balazsorban44commented, Jan 29, 2022

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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found