-
Notifications
You must be signed in to change notification settings - Fork 20
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
Question: Feature Flags in Server-Side Next.js #39
Comments
I have been extracting it from the cookie for my next.js api routes. I have been thinking of somehow generating the distinct id on the server-side and pass it to |
Hey! Personal API keys are used to improve the performance of flag calculations, by ensuring flags with no filters calculate without having to hit PostHog for a response. It is suboptimal to use a Personal API Key, and there's a discussion happening to figure out the approach going forward. See: |
We now our Next.js guide now talks about how to use server side feature flags: https://posthog.com/docs/integrate/third-party/next-js |
Context
Next.js (and many other frameworks) provide methods for server-side rendering/hydrating of React components. In Next, this is achieved by exporting a function called
getServerSideProps
from the same file as your page component.getServerSideProps
can have access to the logged-in user and allows redirects, including out-of-the-box support for 404 pages.For pages that aren't yet available to the public, I'd like to use a feature flag and the user identity to return the correct props or redirect.
The Problem
It seems that the current
posthog-node
implementation requires a personal API key with full account access rather than an organizational API key with scoped account access. This seems to imply that API keys are intended to exist for dev/analytics tools for team members and not for production application use.The Question
Does instantiating
posthog-node
on the server with a personal API key provide any additional access to the API through the posthog instance?The text was updated successfully, but these errors were encountered: