PostHog / posthog

🦔 PostHog provides open-source web & product analytics, session recording, feature flagging and A/B testing that you can self-host. Get started - free.
https://posthog.com
Other
21.82k stars 1.3k forks source link

Error: × `ssr: false` is not allowed with `next/dynamic` in Server Components #26016

Open ItayElgazar opened 3 days ago

ItayElgazar commented 3 days ago

Bug Description

Bug description

In the next.js docs, it is mentioned that the PosthogPageView needs to be dynamically imported at the layout level, which usually is a server component. I did it, and that's what I get:

Error:   × `ssr: false` is not allowed with `next/dynamic` in Server Components

Please describe. If this affects the front-end, screenshots would be of great help.

If you are on PostHog Cloud it would be really valuable if you can share any links where the problem occurs. This speeds up our ability to troubleshoot tremendously.

Debug info

- [ ] PostHog Cloud, Debug information: [please copy/paste from https://us.posthog.com/settings/project-details#variables or https://eu.posthog.com/settings/project-details#variables]
- [ ] PostHog Hobby self-hosted with `docker compose`, version/commit: [please provide]
- [ ] PostHog self-hosted with Kubernetes (deprecated, see [`Sunsetting Kubernetes support`](https://posthog.com/blog/sunsetting-helm-support-posthog)), version/commit: [please provide]
alberto-abarzua commented 2 days ago

I am having the same issue with 15.0.2, all my next/dynamic imports raise this issue.