Issue setting up PostHog on NextJS

After seeing Theo's video on PostHog I thought I'd give it a try it a try. Can't say I've had the best first impression. After following the official docs for NextJS I get an error on page load: "The server could not finish this Suspense boundary, likely due to an error during server rendering. Switched to client rendering." It looks like the issue has been around for a while. - This was raised in November: https://github.com/PostHog/posthog-js/issues/872 - There's a comment from 4 months ago about this: https://posthog.com/docs/libraries/next-js#squeak-questions I tried messaging support in posthog.com and it just errors... feels like the project has a few problems. Is PostHog really stable? Anyone else fixed these issues? Thanks
GitHub
Next.js 14 - The server could not finish this Suspense boundary · I...
Hello, I followed the documentation to the letter to set up Posthog with Next.js, and in production I get this error: Uncaught Error: Minified React error #419; visit https://reactjs.org/docs/error...
Next.js - Docs - PostHog
PostHog makes it easy to get data about traffic and usage of your Next.js app. Integrating PostHog into your site enables analytics about user…
3 Replies
Rhys
Rhys12mo ago
PostHog is stable on Next, although it is a bit of a pain to setup I’ll post a more detailed answer in a few hours but here’s an open source repo of mine you can use as a reference https://github.com/AnswerOverflow/AnswerOverflow/blob/main/packages/ui/src/components/layouts/root.tsx
GitHub
AnswerOverflow/packages/ui/src/components/layouts/root.tsx at main ...
Indexing Discord Help Channel Questions into Google - AnswerOverflow/AnswerOverflow
Rhys
Rhys12mo ago
<Suspense> <PostHogPageview /> <IdUser /> </Suspense> And <Providers/> is what you want to look at, although it’s a monorepo so things are a bit split out
jimotron
jimotronOP12mo ago
@Rhys as reece I pulled down the repo and it looks near identical to the offical docs, which is what I followed and got the issue. Are you not getting this issue with Next13 / 14? I only see it with the production build, dev mode is fine.
Want results from more Discord servers?
Add your server